-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # gradle.properties
- Loading branch information
Showing
37 changed files
with
827 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/com/minelittlepony/unicopia/mixin/MixinEntityView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.minelittlepony.unicopia.mixin; | ||
|
||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import com.minelittlepony.unicopia.entity.collision.EntityCollisions; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.math.Box; | ||
import net.minecraft.util.shape.VoxelShape; | ||
import net.minecraft.world.EntityView; | ||
|
||
@Mixin(EntityView.class) | ||
interface MixinEntityView { | ||
@Inject(method = "getEntityCollisions(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Box;)Ljava/util/List;", at = @At("RETURN"), cancellable = true) | ||
private void onGetEntityCollisions(@Nullable Entity entity, Box box, CallbackInfoReturnable<List<VoxelShape>> info) { | ||
if (box.getAverageSideLength() < 1.0E-7D) { | ||
return; | ||
} | ||
|
||
List<VoxelShape> shapes = EntityCollisions.getColissonShapes(entity, (EntityView)this, box); | ||
if (!shapes.isEmpty()) { | ||
info.setReturnValue(Stream.concat(shapes.stream(), info.getReturnValue().stream()).toList()); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/minelittlepony/unicopia/mixin/MixinVanillaBiomeParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.minelittlepony.unicopia.mixin; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
import com.minelittlepony.unicopia.server.world.gen.BiomeSelectionInjector; | ||
import com.mojang.datafixers.util.Pair; | ||
|
||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.biome.source.util.MultiNoiseUtil; | ||
import net.minecraft.world.biome.source.util.VanillaBiomeParameters; | ||
|
||
@Mixin(VanillaBiomeParameters.class) | ||
abstract class MixinVanillaBiomeParameters { | ||
@ModifyVariable(method = "writeOverworldBiomeParameters", at = @At("HEAD")) | ||
private Consumer<Pair<MultiNoiseUtil.NoiseHypercube, RegistryKey<Biome>>> onWriteOverworldBiomeParameters(Consumer<Pair<MultiNoiseUtil.NoiseHypercube, RegistryKey<Biome>>> parametersCollector) { | ||
return new BiomeSelectionInjector(parametersCollector); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java/com/minelittlepony/unicopia/mixin/forgified/MixinIForgeBoat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.minelittlepony.unicopia.mixin.forgified; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.injection.*; | ||
import com.minelittlepony.unicopia.entity.duck.LavaAffine; | ||
import net.minecraft.fluid.Fluid; | ||
import net.minecraft.fluid.FluidState; | ||
import net.minecraft.fluid.Fluids; | ||
import net.minecraft.registry.tag.FluidTags; | ||
|
||
@Pseudo | ||
@Mixin(targets = "net.minecraftforge.common.extensions.IForgeBoat") | ||
interface MixinIForgeBoat { | ||
@ModifyVariable( | ||
method = "canBoatInFluid(Lnet/minecraft/fluid/FluidState;)Z", | ||
at = @At("HEAD"), | ||
ordinal = 0, | ||
argsOnly = true, | ||
require = 0 | ||
) | ||
private FluidState modifyFluidState(FluidState incoming) { | ||
if (this instanceof LavaAffine a && a.isLavaAffine()) { | ||
if (incoming.isIn(FluidTags.WATER)) { | ||
return Fluids.LAVA.getDefaultState(); | ||
} | ||
if (incoming.isIn(FluidTags.LAVA)) { | ||
return Fluids.WATER.getDefaultState(); | ||
} | ||
} | ||
|
||
return incoming; | ||
} | ||
@SuppressWarnings("deprecation") | ||
@ModifyVariable( | ||
method = "canBoatInFluid(Lnet/minecraft/fluid/Fluid;)Z", | ||
at = @At("HEAD"), | ||
ordinal = 0, | ||
argsOnly = true, | ||
require = 0 | ||
) | ||
private Fluid modifyFluid(Fluid incoming) { | ||
if (this instanceof LavaAffine a && a.isLavaAffine()) { | ||
if (incoming.isIn(FluidTags.WATER)) { | ||
return Fluids.LAVA; | ||
} | ||
if (incoming.isIn(FluidTags.LAVA)) { | ||
return Fluids.WATER; | ||
} | ||
} | ||
|
||
return incoming; | ||
} | ||
} |
Oops, something went wrong.