Skip to content

Commit

Permalink
Fix Much Mixin Invoker Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Nov 2, 2023
1 parent abfdfe8 commit b6d84ee
Show file tree
Hide file tree
Showing 26 changed files with 82 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public CustomPointedDripstoneBlock(Block dripstoneBlock, Settings settings, bool
@Override
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, RandomGenerator random) {
PointedDripstoneBlock.maybeDripFluid(state, world, pos, random.nextFloat());
if (random.nextFloat() < 0.011377778f && PointedDripstoneBlockAccessor.isHeldByPointedDripstone(state, world, pos)) {
if (random.nextFloat() < 0.011377778f && PointedDripstoneBlockAccessor.invokeIsHeldByPointedDripstone(state, world, pos)) {
this.tryGrowCustom(state, world, pos, random);
}
}
Expand All @@ -63,11 +63,11 @@ public void tryGrowCustom(BlockState state, ServerWorld world, BlockPos pos, Ran

if (this.canGrow(firstState, secondState)) {

BlockPos blockPos = PointedDripstoneBlockAccessor.getTipPos(state, world, pos, 7, false);
BlockPos blockPos = PointedDripstoneBlockAccessor.invokeGetTipPos(state, world, pos, 7, false);
if (blockPos != null) {

BlockState thirdState = world.getBlockState(blockPos);
if (PointedDripstoneBlock.canDrip(thirdState) && PointedDripstoneBlockAccessor.canGrow(thirdState, world, blockPos)) {
if (PointedDripstoneBlock.canDrip(thirdState) && PointedDripstoneBlockAccessor.invokeCanGrow(thirdState, world, blockPos)) {

if (random.nextBoolean()) {
this.tryGrowCustom(world, blockPos, Direction.DOWN);
Expand All @@ -90,17 +90,17 @@ public void tryGrowCustomStalagmite(ServerWorld world, BlockPos pos) {
return;
}

if (PointedDripstoneBlockAccessor.isTip(state, Direction.UP) && PointedDripstoneBlockAccessor.canGrow(state, world, mutable)) {
if (PointedDripstoneBlockAccessor.invokeIsTip(state, Direction.UP) && PointedDripstoneBlockAccessor.invokeCanGrow(state, world, mutable)) {
this.tryGrowCustom(world, mutable, Direction.UP);
return;
}

if (PointedDripstoneBlockAccessor.canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWater(mutable.down())) {
if (PointedDripstoneBlockAccessor.invokeCanPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWater(mutable.down())) {
this.tryGrowCustom(world, mutable.down(), Direction.UP);
return;
}

if (!PointedDripstoneBlockAccessor.canDripThrough(world, mutable, state)) {
if (!PointedDripstoneBlockAccessor.invokeCanDripThrough(world, mutable, state)) {
return;
}
}
Expand All @@ -110,7 +110,7 @@ public void tryGrowCustom(ServerWorld world, BlockPos pos, Direction direction)
BlockPos directionPos = pos.offset(direction);
BlockState state = world.getBlockState(directionPos);

if (PointedDripstoneBlockAccessor.isTip(state, direction.getOpposite())) {
if (PointedDripstoneBlockAccessor.invokeIsTip(state, direction.getOpposite())) {
this.growCustomMerged(state, world, directionPos);
} else if (state.isAir() || state.isOf(Blocks.WATER)) {
this.placeCustom(world, directionPos, direction, Thickness.TIP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public BlockSettingsModifiers invisibleSides() {
}

public static boolean always(BlockState state, BlockView world, BlockPos pos) {
return BlocksAccessor.always(state, world, pos);
return BlocksAccessor.invokeAlways(state, world, pos);
}

public static boolean never(BlockState state, BlockView world, BlockPos pos) {
return BlocksAccessor.never(state, world, pos);
return BlocksAccessor.invokeNever(state, world, pos);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public static void addEntityBuilder(RenderLayer layer) {
}

public static RenderLayer.MultiPhase of(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, RenderLayer.MultiPhaseParameters phaseData) {
return RenderLayerFirstAccessor.of(name, vertexFormat, drawMode, expectedBufferSize, phaseData);
return RenderLayerFirstAccessor.invokeOf(name, vertexFormat, drawMode, expectedBufferSize, phaseData);
}

public static RenderLayer.MultiPhase of(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, RenderLayer.MultiPhaseParameters phases) {
return RenderLayerSecondAccessor.of(name, vertexFormat, drawMode, expectedBufferSize, hasCrumbling, translucent, phases);
return RenderLayerSecondAccessor.invokeOf(name, vertexFormat, drawMode, expectedBufferSize, hasCrumbling, translucent, phases);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class CustomPOI implements POIRegistrable {
private final PointOfInterestType type;

public static Set<BlockState> getStates(Block block) {
return PointOfInterestTypesAccessor.states(block);
return PointOfInterestTypesAccessor.invokeStates(block);
}

public CustomPOI(Block block, int maxTickets, int searchDistance) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default void register(Identifier identifier) {
if (this instanceof CustomPOI POI && this.isNotRegistered()) {
RegistryKey<PointOfInterestType> key = RegistryKey.of(Registry.POINT_OF_INTEREST_TYPE_KEY, identifier);
RegistrationUtils.registerPointOfInterestType(identifier, POI.getType());
PointOfInterestTypesAccessor.addStates(Registry.POINT_OF_INTEREST_TYPE.getHolderOrThrow(key));
PointOfInterestTypesAccessor.invokeAddStates(Registry.POINT_OF_INTEREST_TYPE.getHolderOrThrow(key));
this.setRegistered();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public CustomPotion(@Nullable String string, StatusEffectInstance... statusEffec
* @see MModdingBootstrapInitializer
*/
public CustomPotion addBrewingRecipe(Potion basePotion, Item ingredient) {
BrewingRecipeRegistryAccessor.registerPotionRecipe(basePotion, ingredient, this);
BrewingRecipeRegistryAccessor.invokeRegisterPotionRecipe(basePotion, ingredient, this);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
public class NoiseParametersUtils {

public static void registerGroupedBiomeNoises(Registry<DoublePerlinNoiseSampler.NoiseParameters> registry, int octaveOffset, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> temperatureKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> vegetationKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> continentalnessKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> erosionKey) {
BuiltinNoiseParametersAccessor.registerBiomeNoises(registry, octaveOffset, temperatureKey, vegetationKey, continentalnessKey, erosionKey);
BuiltinNoiseParametersAccessor.invokeRegisterBiomeNoises(registry, octaveOffset, temperatureKey, vegetationKey, continentalnessKey, erosionKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,70 @@
public class NoiseRouterUtils {

public static void registerSlopedCheeseFunction(Registry<DensityFunction> registry, DensityFunction jaggedNoise, Holder<DensityFunction> continents, Holder<DensityFunction> erosion, RegistryKey<DensityFunction> offsetKey, RegistryKey<DensityFunction> factorKey, RegistryKey<DensityFunction> jaggednessKey, RegistryKey<DensityFunction> depthKey, RegistryKey<DensityFunction> slopedCheeseKey, boolean amplified) {
NoiseRouterDataAccessor.method_41548(registry, jaggedNoise, continents, erosion, offsetKey, factorKey, jaggednessKey, depthKey, slopedCheeseKey, amplified);
NoiseRouterDataAccessor.invokeMethod_41548(registry, jaggedNoise, continents, erosion, offsetKey, factorKey, jaggednessKey, depthKey, slopedCheeseKey, amplified);
}

public static DensityFunction registerAndGetHolder(Registry<DensityFunction> registry, RegistryKey<DensityFunction> registryKey, DensityFunction densityFunction) {
return NoiseRouterDataAccessor.method_41551(registry, registryKey, densityFunction);
return NoiseRouterDataAccessor.invokeMethod_41551(registry, registryKey, densityFunction);
}

public static Holder<DensityFunction> register(Registry<DensityFunction> registry, RegistryKey<DensityFunction> registryKey, DensityFunction densityFunction) {
return NoiseRouterDataAccessor.register(registry, registryKey, densityFunction);
return NoiseRouterDataAccessor.invokeRegister(registry, registryKey, densityFunction);
}

public static Holder<DoublePerlinNoiseSampler.NoiseParameters> getNoise(RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> key) {
return NoiseRouterDataAccessor.getNoise(key);
return NoiseRouterDataAccessor.invokeGetNoise(key);
}

public static DensityFunction getFunction(Registry<DensityFunction> registry, RegistryKey<DensityFunction> key) {
return NoiseRouterDataAccessor.getFunction(registry, key);
return NoiseRouterDataAccessor.invokeGetFunction(registry, key);
}

public static DensityFunction createRidgesFoldedOverworldFunction(DensityFunction input) {
return NoiseRouterDataAccessor.method_41547(input);
return NoiseRouterDataAccessor.invokeMethod_41547(input);
}

public static DensityFunction createUndergroundCaves(Registry<DensityFunction> registry, DensityFunction slopedCheese) {
return NoiseRouterDataAccessor.underground(registry, slopedCheese);
return NoiseRouterDataAccessor.invokeUnderground(registry, slopedCheese);
}

public static DensityFunction applyBlendDensity(DensityFunction densityFunction) {
return NoiseRouterDataAccessor.postProcess(densityFunction);
return NoiseRouterDataAccessor.invokePostProcess(densityFunction);
}

public static DensityFunction applySurfaceSlides(boolean amplified, DensityFunction densityFunction) {
return NoiseRouterDataAccessor.method_42366(amplified, densityFunction);
return NoiseRouterDataAccessor.invokeMethod_42366(amplified, densityFunction);
}

public static DensityFunction applyCavesSlides(Registry<DensityFunction> registry, int minY, int maxY) {
return NoiseRouterDataAccessor.method_42363(registry, minY, maxY);
return NoiseRouterDataAccessor.invokeMethod_42363(registry, minY, maxY);
}

public static DensityFunction applyFloatingIslandsSlides(DensityFunction densityFunction, int minY, int maxY) {
return NoiseRouterDataAccessor.method_42364(densityFunction, minY, maxY);
return NoiseRouterDataAccessor.invokeMethod_42364(densityFunction, minY, maxY);
}

public static DensityFunction applyEndSlides(DensityFunction densityFunction) {
return NoiseRouterDataAccessor.method_42367(densityFunction);
return NoiseRouterDataAccessor.invokeMethod_42367(densityFunction);
}

public static NoiseRouter emptyNoiseRouter() {
return NoiseRouterDataAccessor.method_44324();
return NoiseRouterDataAccessor.invokeMethod_44324();
}

public static DensityFunction applyBlending(DensityFunction densityFunction, DensityFunction blendOffset) {
return NoiseRouterDataAccessor.splineWithBlending(densityFunction, blendOffset);
return NoiseRouterDataAccessor.invokeSplineWithBlending(densityFunction, blendOffset);
}

public static DensityFunction createInitialDensityFunction(DensityFunction factor, DensityFunction depth) {
return NoiseRouterDataAccessor.noiseGradientDensity(factor, depth);
return NoiseRouterDataAccessor.invokeNoiseGradientDensity(factor, depth);
}

public static DensityFunction verticalRangeChoice(DensityFunction y, DensityFunction whenInRange, int minInclusive, int maxInclusive, int whenOutOfRange) {
return NoiseRouterDataAccessor.yLimitedInterpolatable(y, whenInRange, minInclusive, maxInclusive, whenOutOfRange);
return NoiseRouterDataAccessor.invokeYLimitedInterpolatable(y, whenInRange, minInclusive, maxInclusive, whenOutOfRange);
}

public static DensityFunction applySlides(DensityFunction densityFunction, int minY, int maxY, int topRelativeMinY, int topRelativeMaxY, double topDensity, int bottomRelativeMinY, int bottomRelativeMaxY, double bottomDensity) {
return NoiseRouterDataAccessor.method_42365(densityFunction, minY, maxY, topRelativeMinY, topRelativeMaxY, topDensity, bottomRelativeMinY, bottomRelativeMaxY, bottomDensity);
return NoiseRouterDataAccessor.invokeMethod_42365(densityFunction, minY, maxY, topRelativeMinY, topRelativeMaxY, topDensity, bottomRelativeMinY, bottomRelativeMaxY, bottomDensity);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class RecipeSerializationUtils {

public static Ingredient getIngredient(Stream<Ingredient.Entry> entries) {
return IngredientAccessor.ofEntries(entries);
return IngredientAccessor.invokeOfEntries(entries);
}

public static Ingredient.StackEntry getIngredientStack(JsonObject json) {
Expand All @@ -44,7 +44,7 @@ public static Ingredient.TagEntry getIngredientTag(JsonObject json) {
}

public static Ingredient.Entry getIngredientEntry(JsonObject json) {
return IngredientAccessor.entryFromJson(json);
return IngredientAccessor.invokeEntryFromJson(json);
}

public static ItemStack getStackWithoutData(JsonObject json) {
Expand All @@ -70,7 +70,7 @@ public static Item getItem(JsonObject json) {
}

public static DefaultedList<Ingredient> getIngredients(JsonObject json, String key, int number) {
DefaultedList<Ingredient> ingredients = ShapelessRecipeSerializerAccessor.getIngredients(JsonHelper.getArray(json, key));
DefaultedList<Ingredient> ingredients = ShapelessRecipeSerializerAccessor.invokeGetIngredients(JsonHelper.getArray(json, key));
if (ingredients.isEmpty()) {
throw new JsonParseException("No Ingredients For Recipe");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void createPlayerInventory(ScreenHandler screenHandler, PlayerInve

for (int line = 0; line < 3; line++) {
for (int column = 0; column < 9; column++) {
accessor.addSlot(new Slot(playerInventory, column + line * 9 + 9, 8 + column * 18, 84 + line * 18));
accessor.invokeAddSlot(new Slot(playerInventory, column + line * 9 + 9, 8 + column * 18, 84 + line * 18));
}
}
}
Expand All @@ -26,7 +26,7 @@ public static void createPlayerHotBar(ScreenHandler screenHandler, PlayerInvento
ScreenHandlerAccessor accessor = (ScreenHandlerAccessor) screenHandler;

for (int hotBarSlot = 0; hotBarSlot < 9; hotBarSlot++) {
accessor.addSlot(new Slot(playerInventory, hotBarSlot, 8 + hotBarSlot * 18, 142));
accessor.invokeAddSlot(new Slot(playerInventory, hotBarSlot, 8 + hotBarSlot * 18, 142));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
public interface BlocksAccessor {

@Invoker("always")
static boolean always(BlockState state, BlockView world, BlockPos pos) {
static boolean invokeAlways(BlockState state, BlockView world, BlockPos pos) {
throw new AssertionError();
}

@Invoker("never")
static boolean never(BlockState state, BlockView world, BlockPos pos) {
static boolean invokeNever(BlockState state, BlockView world, BlockPos pos) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public interface BrewingRecipeRegistryAccessor {

@Invoker("registerPotionRecipe")
static void registerPotionRecipe(Potion input, Item item, Potion output) {
static void invokeRegisterPotionRecipe(Potion input, Item item, Potion output) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public interface BuiltinNoiseParametersAccessor {

@Invoker("registerBiomeNoises")
static void registerBiomeNoises(Registry<DoublePerlinNoiseSampler.NoiseParameters> registry, int i, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> firstKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> secondKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> thirdKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> fourthKey) {
static void invokeRegisterBiomeNoises(Registry<DoublePerlinNoiseSampler.NoiseParameters> registry, int i, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> firstKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> secondKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> thirdKey, RegistryKey<DoublePerlinNoiseSampler.NoiseParameters> fourthKey) {
throw new AssertionError();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
public interface FluidAccessor {

@Invoker("getVelocity")
Vec3d getVelocity(BlockView world, BlockPos pos, FluidState state);
Vec3d invokeGetVelocity(BlockView world, BlockPos pos, FluidState state);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
public interface IngredientAccessor {

@Invoker("ofEntries")
static Ingredient ofEntries(Stream<? extends Ingredient.Entry> entries) {
static Ingredient invokeOfEntries(Stream<? extends Ingredient.Entry> entries) {
throw new AssertionError();
}

@Invoker("entryFromJson")
static Ingredient.Entry entryFromJson(JsonObject json) {
static Ingredient.Entry invokeEntryFromJson(JsonObject json) {
throw new AssertionError();
}
}
Loading

0 comments on commit b6d84ee

Please sign in to comment.