Skip to content

Commit

Permalink
feat: more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 29, 2024
1 parent 65e5e70 commit 26c378d
Show file tree
Hide file tree
Showing 122 changed files with 578 additions and 44 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public Redux(IEventBus bus, Dist dist) {

ReduxConfigHandler.setup(bus);

ConfigCondition.registerSerializer("redux_server", new ConfigSerializer(ReduxConfig.Server::serialize, ReduxConfig.Server::deserialize));
ConfigCondition.registerSerializer("redux_common", new ConfigSerializer(ReduxConfig.Common::serialize, ReduxConfig.Common::deserialize));
ConfigCondition.registerSerializer("redux_server", new ConfigSerializer(ReduxConfig.SERVER::serialize, ReduxConfig.SERVER::deserialize));
ConfigCondition.registerSerializer("redux_common", new ConfigSerializer(ReduxConfig.COMMON::serialize, ReduxConfig.COMMON::deserialize));
}

private void commonSetup(final FMLCommonSetupEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public BlockState setValues(Level level, BlockPos pos, BlockState state) {
GrassSize size = GrassSize.values()[i];
BlockState b = state.setValue(ReduxStates.GRASS_SIZE, size);
BlockPos below = pos.below();
if (level.getBlockState(below).is(AetherBlocks.ENCHANTED_AETHER_GRASS_BLOCK.get())) {
if (level.getBlockState(below).is(ReduxTags.Blocks.ENCHANTED_GRASS_BLOCKS)) {
return b.setValue(ReduxStates.ENCHANTED, true);
}
return b;
Expand All @@ -96,7 +96,7 @@ public BlockState updateShape(BlockState state, Direction facing, BlockState fac
b = b.setValue(ReduxStates.GRASS_SIZE, size);
}
if (b.hasProperty(ReduxStates.ENCHANTED) && facing == Direction.DOWN) {
if (level.getBlockState(facingPos).is(AetherBlocks.ENCHANTED_AETHER_GRASS_BLOCK.get())) {
if (level.getBlockState(facingPos).is(ReduxTags.Blocks.ENCHANTED_GRASS_BLOCKS)) {
return b.setValue(ReduxStates.ENCHANTED, true);
}
return b.setValue(ReduxStates.ENCHANTED, false);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/zepalesque/redux/client/ReduxColors.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static int getAverageColor(BlockAndTintGetter level, BlockPos blockPos,
public static int getColor(BlockState state, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos, int index, int indexGoal, boolean useBelowProperties) {
if (index == indexGoal) {
if (level != null && pos != null) {
if (level.getBlockState(pos.below()).is(ReduxTags.Blocks.SHORT_GRASS_BLIGHT_OVERRIDE) && useBelowProperties) {
if (level.getBlockState(pos.below()).is(ReduxTags.Blocks.BLIGHT_GRASS_BLOCKS) && useBelowProperties) {
return Tints.BLIGHT_GRASS_COLOR;
} else if (state.hasProperty(ReduxStates.ENCHANTED) && state.getValue(ReduxStates.ENCHANTED)) {
return 0xFFFFFF;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package net.zepalesque.redux.config;

import com.google.gson.JsonSyntaxException;
import net.neoforged.neoforge.common.ModConfigSpec;

import java.util.Arrays;
import java.util.List;

public class DataSerializableConfig {

protected final ModConfigSpec spec;

public DataSerializableConfig(ModConfigSpec spec) {
this.spec = spec;
}

public String serialize(ModConfigSpec.ConfigValue<Boolean> config) {
try {
return config.getPath().toString();
} catch (NullPointerException e) {
throw new JsonSyntaxException("Error loading config entry from JSON! Maybe the config key is incorrect?");
}
}

public ModConfigSpec.ConfigValue<Boolean> deserialize(String string) {
List<String> path = Arrays.asList(string.replace("[", "").replace("]", "").split(", "));

return this.spec().getValues().get(path);
}

public ModConfigSpec spec() {
return spec;
}
}
40 changes: 4 additions & 36 deletions src/main/java/net/zepalesque/redux/config/ReduxConfig.java
Original file line number Diff line number Diff line change
@@ -1,68 +1,36 @@
package net.zepalesque.redux.config;

import com.google.gson.JsonSyntaxException;
import net.neoforged.neoforge.common.ModConfigSpec;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Arrays;
import java.util.List;

public class ReduxConfig {

public static class Server {
public static class Server extends DataSerializableConfig {

public final ModConfigSpec.ConfigValue<Boolean> placeholder;

public Server(ModConfigSpec.Builder builder) {
super(SERVER_SPEC);
builder.push("TODO");
placeholder = builder
.comment("Temporary placeholder config, used")
.define("Placeholder Config", true);
builder.pop();
}

public static String serialize(ModConfigSpec.ConfigValue<Boolean> config) {
try {
return config.getPath().toString();
} catch (NullPointerException e) {
throw new JsonSyntaxException("Error loading config entry from JSON! Maybe the config key is incorrect?");
}
}

public static ModConfigSpec.ConfigValue<Boolean> deserialize(String string) {
List<String> path = Arrays.asList(string.replace("[", "").replace("]", "").split(", "));
ModConfigSpec.ConfigValue<Boolean> config = SERVER_SPEC.getValues().get(path);

return config;
}
}

public static class Common {
public static class Common extends DataSerializableConfig {

public final ModConfigSpec.ConfigValue<Boolean> placeholder;

public Common(ModConfigSpec.Builder builder) {
super(COMMON_SPEC);
builder.push("TODO");
placeholder = builder
.comment("Temporary placeholder config, used")
.define("Placeholder Config", true);
builder.pop();
}

public static String serialize(ModConfigSpec.ConfigValue<Boolean> config) {
try {
return config.getPath().toString();
} catch (NullPointerException e) {
throw new JsonSyntaxException("Error loading config entry from JSON! Maybe the config key is incorrect?");
}
}

public static ModConfigSpec.ConfigValue<Boolean> deserialize(String string) {
List<String> path = Arrays.asList(string.replace("[", "").replace("]", "").split(", "));
ModConfigSpec.ConfigValue<Boolean> config = COMMON_SPEC.getValues().get(path);

return config;
}
}

public static class Client {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/zepalesque/redux/data/ReduxTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.aetherteam.aether.api.AetherAdvancementSoundOverrides;
import com.aetherteam.aether.api.registers.AdvancementSoundOverride;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.TagKey;
import net.minecraft.world.damagesource.DamageType;
Expand All @@ -18,8 +17,10 @@ public class ReduxTags {

public static class Blocks {

public static final TagKey<Block> SHORT_GRASS_BLIGHT_OVERRIDE = tag("short_grass_blight_override");
public static final TagKey<Block> SHORT_GRASS_COLORLESS_OVERRIDE = tag("short_grass_colorless_override");
// Blocks that should override Short Aether Grass's color to be the blight color (blightmoss for instance)
public static final TagKey<Block> BLIGHT_GRASS_BLOCKS = tag("blight_grass_blocks");
// Blocks that should make Short Aether Grass use its enchanted state
public static final TagKey<Block> ENCHANTED_GRASS_BLOCKS = tag("enchanted_grass_blocks");

public static TagKey<Block> tag(String name) {
return TagKey.create(Registries.BLOCK, Redux.loc(name));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"variants": {
"snowy=false": [
{
"model": "aether:block/aether_grass_block"
},
{
"model": "aether:block/aether_grass_block",
"y": 90
},
{
"model": "aether:block/aether_grass_block",
"y": 180
},
{
"model": "aether:block/aether_grass_block",
"y": 270
}
],
"snowy=true": [
{
"model": "aether:block/aether_grass_block_snow"
},
{
"model": "aether:block/aether_grass_block_snow",
"y": 90
},
{
"model": "aether:block/aether_grass_block_snow",
"y": 180
},
{
"model": "aether:block/aether_grass_block_snow",
"y": 270
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"parent": "aether_redux:block/tinted_grass_block",
"textures": {
"bottom": "aether:block/natural/aether_dirt",
"overlay": "aether_redux:block/natural/aether_grass_block_side_overlay",
"particle": "aether:block/natural/aether_dirt",
"side": "aether:block/natural/aether_grass_block_side",
"top": "aether_redux:block/natural/aether_grass_block_top_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "aether_redux:block/natural/purple_flower_overlay",
"plant": "aether_redux:block/natural/purple_flower"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "aether_redux:block/natural/white_flower_overlay",
"plant": "aether_redux:block/natural/white_flower"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/cross/cross_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"cross": "aether_redux:block/natural/purple_flower",
"overlay": "aether_redux:block/natural/purple_flower_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/cross/cross_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"cross": "aether_redux:block/natural/white_flower",
"overlay": "aether_redux:block/natural/white_flower_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"variants": {
"type=normal,length=1": {
"model": "ancient_aether:block/sky_grass_very_short"
},
"type=normal,length=2": {
"model": "ancient_aether:block/sky_grass_short"
},
"type=normal,length=3": {
"model": "ancient_aether:block/sky_grass_medium"
},
"type=normal,length=4": {
"model": "ancient_aether:block/sky_grass_tall"
},
"type=normal,length=5": {
"model": "ancient_aether:block/sky_grass_very_tall"
},
"type=frozen,length=1": {
"model": "ancient_aether:block/sky_grass_very_short"
},
"type=frozen,length=2": {
"model": "ancient_aether:block/sky_grass_short"
},
"type=frozen,length=3": {
"model": "ancient_aether:block/sky_grass_medium"
},
"type=frozen,length=4": {
"model": "ancient_aether:block/sky_grass_tall"
},
"type=frozen,length=5": {
"model": "ancient_aether:block/sky_grass_very_tall"
},
"type=pale,length=1": {
"model": "ancient_aether:block/sky_grass_very_short"
},
"type=pale,length=2": {
"model": "ancient_aether:block/sky_grass_short"
},
"type=pale,length=3": {
"model": "ancient_aether:block/sky_grass_medium"
},
"type=pale,length=4": {
"model": "ancient_aether:block/sky_grass_tall"
},
"type=pale,length=5": {
"model": "ancient_aether:block/sky_grass_very_tall"
},
"type=enchanted,length=1": {
"model": "ancient_aether:block/sky_grass_very_short_enchanted"
},
"type=enchanted,length=2": {
"model": "ancient_aether:block/sky_grass_short_enchanted"
},
"type=enchanted,length=3": {
"model": "ancient_aether:block/sky_grass_medium_enchanted"
},
"type=enchanted,length=4": {
"model": "ancient_aether:block/sky_grass_tall_enchanted"
},
"type=enchanted,length=5": {
"model": "ancient_aether:block/sky_grass_very_tall_enchanted"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/cross/cross_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"cross": "ancient_aether:block/elevetia",
"overlay": "ancient_aether:block/elevetia_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/cross/cross_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"cross": "ancient_aether:block/highland_viola",
"overlay": "ancient_aether:block/highland_viola_overlay"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "ancient_aether:block/elevatia_overlay",
"plant": "ancient_aether:block/elevatia"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "ancient_aether:block/highland_viola_overlay",
"plant": "ancient_aether:block/highland_viola"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "ancient_aether:block/sakura_blossoms_overlay",
"plant": "ancient_aether:block/sakura_blossoms"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "ancient_aether:block/sky_blues_overlay",
"plant": "ancient_aether:block/sky_blues"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parent": "aether_redux:block/pot/flower_pot_tinted_overlay",
"render_type": "minecraft:cutout",
"textures": {
"overlay": "ancient_aether:block/sunset_rose_overlay",
"plant": "ancient_aether:block/sunset_rose"
}
}
Loading

0 comments on commit 26c378d

Please sign in to comment.