forked from TISUnion/Carpet-TIS-Addition
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85b4a8a
commit 6fe2ddd
Showing
64 changed files
with
1,735 additions
and
187 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
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
62 changes: 62 additions & 0 deletions
62
src/main/java/carpettisaddition/commands/spawn/mobcapsLocal/MobcapsLocalCommand.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,62 @@ | ||
package carpettisaddition.commands.spawn.mobcapsLocal; | ||
|
||
import carpettisaddition.commands.CommandExtender; | ||
import carpettisaddition.translations.TranslationContext; | ||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
|
||
//#if MC >= 11800 | ||
//$$ import carpettisaddition.logging.loggers.mobcapsLocal.MobcapsLocalLogger; | ||
//$$ import carpettisaddition.mixins.command.mobcapsLocal.SpawnCommandAccessor; | ||
//$$ import carpettisaddition.utils.Messenger; | ||
//$$ import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
//$$ import net.minecraft.command.argument.EntityArgumentType; | ||
//$$ import net.minecraft.server.network.ServerPlayerEntity; | ||
//$$ import static net.minecraft.command.argument.EntityArgumentType.getPlayer; | ||
//$$ import static net.minecraft.server.command.CommandManager.argument; | ||
//$$ import static net.minecraft.server.command.CommandManager.literal; | ||
//#endif | ||
|
||
public class MobcapsLocalCommand extends TranslationContext implements CommandExtender | ||
{ | ||
private static final MobcapsLocalCommand INSTANCE = new MobcapsLocalCommand(); | ||
|
||
private MobcapsLocalCommand() | ||
{ | ||
super("command.spawn.mobcapsLocal"); | ||
} | ||
|
||
public static MobcapsLocalCommand getInstance() | ||
{ | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public void extendCommand(LiteralArgumentBuilder<ServerCommandSource> builder) | ||
{ | ||
//#if MC >= 11800 | ||
//$$ builder.then(literal("mobcapsLocal"). | ||
//$$ executes(c -> showLocalMobcaps(c.getSource(), c.getSource().getPlayer())). | ||
//$$ then(argument("player", EntityArgumentType.player()). | ||
//$$ executes(c -> showLocalMobcaps(c.getSource(), getPlayer(c, "player"))) | ||
//$$ ) | ||
//$$ ); | ||
//#endif | ||
} | ||
|
||
//#if MC >= 11800 | ||
//$$ private int showLocalMobcaps(ServerCommandSource source, ServerPlayerEntity targetPlayer) throws CommandSyntaxException | ||
//$$ { | ||
//$$ int[] ret = new int[1]; | ||
//$$ MobcapsLocalLogger.getInstance().withLocalMobcapContext( | ||
//$$ targetPlayer, | ||
//$$ () -> { | ||
//$$ Messenger.tell(source, tr("info", targetPlayer.getDisplayName())); | ||
//$$ ret[0] = SpawnCommandAccessor.invokeGeneralMobcaps(source); | ||
//$$ }, | ||
//$$ () -> ret[0] = 0 | ||
//$$ ); | ||
//$$ return ret[0]; | ||
//$$ } | ||
//#endif | ||
} |
19 changes: 19 additions & 0 deletions
19
...n/java/carpettisaddition/helpers/rule/optimizedFastEntityMovement/CollisionBoxGetter.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,19 @@ | ||
package carpettisaddition.helpers.rule.optimizedFastEntityMovement; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.math.Box; | ||
import net.minecraft.util.shape.VoxelShape; | ||
import net.minecraft.world.CollisionView; | ||
|
||
import java.util.stream.Stream; | ||
|
||
@FunctionalInterface | ||
public interface CollisionBoxGetter | ||
{ | ||
//#if MC >= 11800 | ||
//$$ Iterable<VoxelShape> | ||
//#else | ||
Stream<VoxelShape> | ||
//#endif | ||
get(CollisionView world, Entity entity, Box box); | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/carpettisaddition/helpers/rule/optimizedFastEntityMovement/OFEMContext.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,24 @@ | ||
package carpettisaddition.helpers.rule.optimizedFastEntityMovement; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.math.Box; | ||
import net.minecraft.util.math.Direction; | ||
import net.minecraft.world.World; | ||
|
||
public class OFEMContext | ||
{ | ||
// basic info | ||
public final World world; | ||
public final Entity entity; | ||
|
||
// for per getAxisOnlyBlockCollision call | ||
public Direction.Axis axis; | ||
public double movementOnAxis; | ||
public Box entityBoundingBox; | ||
|
||
public OFEMContext(World world, Entity entity) | ||
{ | ||
this.world = world; | ||
this.entity = entity; | ||
} | ||
} |
Oops, something went wrong.