Migrate Carpet Mixin names to mojang mappings

This commit is contained in:
FX - PR0CESS committed 2022-01-28 16:47:18 -05:00
1 parent 2c3871b90e
commit a547677597
154 files changed
+422 -501

No files matched your search

@@ -1,11 +1,10 @@
package carpet.script.api;
import carpet.mixins.ScoreboardObjective_scarpetMixin;
import carpet.mixins.Objective_scarpetMixin;
import carpet.mixins.Scoreboard_scarpetMixin;
import carpet.mixins.Team_scarpetMixin;
import carpet.mixins.PlayerTeam_scarpetMixin;
import carpet.script.CarpetContext;
import carpet.script.Expression;
import carpet.script.LazyValue;
import carpet.script.exception.InternalExpressionException;
import carpet.script.exception.ThrowStatement;
import carpet.script.exception.Throwables;
@@ -148,7 +147,7 @@ public class Scoreboards {
if(lv.size() == 1) return StringValue.of(objective.getCriteria().getName());
if(objective.getCriteria().equals(criterion) || lv.size() == 1) return Value.NULL;
((Scoreboard_scarpetMixin)scoreboard).getObjectivesByCriterion().get(objective.getCriteria()).remove(objective);
((ScoreboardObjective_scarpetMixin) objective).setCriterion(criterion);
((Objective_scarpetMixin) objective).setCriterion(criterion);
(((Scoreboard_scarpetMixin)scoreboard).getObjectivesByCriterion().computeIfAbsent(criterion, (criterion1) -> Lists.newArrayList())).add(objective);
scoreboard.onObjectiveAdded(objective);
return Value.FALSE;
@@ -179,7 +178,7 @@ public class Scoreboards {
if (criterion==null) throw new InternalExpressionException("Unknown scoreboard criterion: "+ setValue.getString());
if(objective.getCriteria().equals(criterion) || lv.size() == 1) return Value.FALSE;
((Scoreboard_scarpetMixin)scoreboard).getObjectivesByCriterion().get(objective.getCriteria()).remove(objective);
((ScoreboardObjective_scarpetMixin) objective).setCriterion(criterion);
((Objective_scarpetMixin) objective).setCriterion(criterion);
(((Scoreboard_scarpetMixin)scoreboard).getObjectivesByCriterion().computeIfAbsent(criterion, (criterion1) -> Lists.newArrayList())).add(objective);
scoreboard.onObjectiveAdded(objective);
return Value.TRUE;
@@ -337,7 +336,7 @@ public class Scoreboards {
team.setCollisionRule(collisionRule);
break;
case "color":
if(!modifying) return new StringValue(((Team_scarpetMixin) team).getColor().getName());
if(!modifying) return new StringValue(((PlayerTeam_scarpetMixin) team).getColor().getName());
if(!(settingVal instanceof StringValue)) throw new InternalExpressionException("'team_property' requires a string as the third argument for the property " + propertyVal.getString());
ChatFormatting color = ChatFormatting.getByName(settingVal.getString().toUpperCase());
if(color == null || !color.isColor()) throw new InternalExpressionException("Unknown value for property " + propertyVal.getString() + ": " + settingVal.getString());
@@ -2,7 +2,6 @@ package carpet.script.api;
import carpet.CarpetServer;
import carpet.CarpetSettings;
import carpet.fakes.BiomeArrayInterface;
import carpet.fakes.ChunkGeneratorInterface;
import carpet.fakes.ChunkTicketManagerInterface;
import carpet.fakes.NoiseColumnSamplerInterface;
@@ -11,12 +10,11 @@ import carpet.fakes.ServerWorldInterface;
import carpet.fakes.SpawnHelperInnerInterface;
import carpet.fakes.ThreadedAnvilChunkStorageInterface;
import carpet.helpers.FeatureGenerator;
import carpet.mixins.PointOfInterest_scarpetMixin;
import carpet.mixins.PoiRecord_scarpetMixin;
import carpet.script.CarpetContext;
import carpet.script.Context;
import carpet.script.Expression;
import carpet.script.Fluff;
import carpet.script.LazyValue;
import carpet.script.annotation.Locator;
import carpet.script.annotation.ScarpetFunction;
import carpet.script.argument.BlockArgument;
@@ -295,7 +293,7 @@ public class WorldAccess {
return Value.NULL;
return ListValue.of(
new StringValue(poi.getPoiType().toString()),
new NumericValue(poiType.getMaxTickets() - ((PointOfInterest_scarpetMixin)poi).getFreeTickets())
new NumericValue(poiType.getMaxTickets() - ((PoiRecord_scarpetMixin)poi).getFreeTickets())
);
}
int radius = NumericValue.asNumber(lv.get(locator.offset+0)).getInt();
@@ -335,7 +333,7 @@ public class WorldAccess {
return ListValue.wrap(pois.sorted(Comparator.comparingDouble(p -> p.getPos().distSqr(pos))).map(p ->
ListValue.of(
new StringValue(p.getPoiType().toString()),
new NumericValue(p.getPoiType().getMaxTickets() - ((PointOfInterest_scarpetMixin)p).getFreeTickets()),
new NumericValue(p.getPoiType().getMaxTickets() - ((PoiRecord_scarpetMixin)p).getFreeTickets()),
ListValue.of(new NumericValue(p.getPos().getX()), new NumericValue(p.getPos().getY()), new NumericValue(p.getPos().getZ()))
)
).collect(Collectors.toList()));
@@ -375,7 +373,7 @@ public class WorldAccess {
int finalO = occupancy;
store.getInSquare((tt) -> tt==type, pos, 1, PoiManager.Occupancy.ANY
).filter(p -> p.getPos().equals(pos)).findFirst().ifPresent(p -> {
for (int i=0; i < finalO; i++) ((PointOfInterest_scarpetMixin)p).callAcquireTicket();
for (int i=0; i < finalO; i++) ((PoiRecord_scarpetMixin)p).callAcquireTicket();
});
}
return Value.TRUE;