-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from Talia-12/1.20.1
Bring texture-based pattern rendering to 1.20
- Loading branch information
Showing
10 changed files
with
492 additions
and
40 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
15 changes: 15 additions & 0 deletions
15
Common/src/main/java/at/petrak/hexcasting/client/render/HexPatternPoints.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,15 @@ | ||
package at.petrak.hexcasting.client.render; | ||
|
||
import net.minecraft.world.phys.Vec2; | ||
|
||
import java.util.List; | ||
|
||
public class HexPatternPoints { | ||
public List<Vec2> zappyPoints = null; | ||
public String pointsKey = null; //TODO: if a string key isnt performant enough override hashcode for points | ||
|
||
public HexPatternPoints(List<Vec2> zappyPoints) { | ||
this.zappyPoints = zappyPoints; | ||
pointsKey = PatternTextureManager.getPointsKey(zappyPoints); | ||
} | ||
} |
357 changes: 357 additions & 0 deletions
357
Common/src/main/java/at/petrak/hexcasting/client/render/PatternTextureManager.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
Common/src/main/java/at/petrak/hexcasting/common/command/PatternTexturesCommand.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 at.petrak.hexcasting.common.command; | ||
|
||
import at.petrak.hexcasting.client.render.PatternTextureManager; | ||
import com.mojang.brigadier.arguments.IntegerArgumentType; | ||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.commands.Commands; | ||
|
||
public class PatternTexturesCommand | ||
{ | ||
public static void add(LiteralArgumentBuilder<CommandSourceStack> cmd) { | ||
cmd.then(Commands.literal("textureToggle") | ||
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) | ||
.executes(ctx -> { | ||
PatternTextureManager.useTextures = !PatternTextureManager.useTextures; | ||
return 1; | ||
})); | ||
cmd.then(Commands.literal("textureRepaint") | ||
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) | ||
.executes(ctx -> { | ||
PatternTextureManager.repaint(); | ||
return 1; | ||
})); | ||
cmd.then(Commands.literal("textureSetResolutionScaler") | ||
.requires(dp -> dp.hasPermission(Commands.LEVEL_ADMINS)) | ||
.then(Commands.argument("integer", IntegerArgumentType.integer()).executes(ctx -> { | ||
PatternTextureManager.setResolutionScaler(IntegerArgumentType.getInteger(ctx, "integer")); | ||
PatternTextureManager.repaint(); | ||
return 1; | ||
}))); | ||
} | ||
} |
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