Skip to content

Commit

Permalink
feat: Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 24, 2024
1 parent 934310e commit 8ef0675
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.core.HolderLookup;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
Expand Down Expand Up @@ -50,4 +51,9 @@ private void dataSetup(GatherDataEvent event) {
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
PackOutput packOutput = generator.getPackOutput();
}

public static ResourceLocation loc(String path) {
return new ResourceLocation(MODID, path);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.zepalesque.redux.block.state.ReduxStates;
import net.zepalesque.redux.block.state.enums.GrassSize;
import net.zepalesque.redux.data.tags.ReduxTags;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -40,7 +41,7 @@ public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos,

@Override
public boolean canBeReplaced(BlockState pState, BlockPlaceContext pUseContext) {
return super.canBeReplaced(pState, pUseContext) && (pUseContext.getItemInHand().getItem() instanceof BlockItem blockItem && !blockItem.getBlock().builtInRegistryHolder().is(ReduxTags.Blocks.DO_NOT_REPLACE_AETHER_GRASS));
return super.canBeReplaced(pState, pUseContext) && (pUseContext.getItemInHand().getItem() instanceof BlockItem blockItem && !blockItem.getBlock().builtInRegistryHolder().is(ReduxTags.Blocks.AETHER_GRASS_NONREPLACING));
}

@Override
Expand Down
69 changes: 69 additions & 0 deletions src/main/java/net/zepalesque/redux/data/tags/ReduxTags.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package net.zepalesque.redux.data.tags;

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;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.zepalesque.redux.Redux;

public class ReduxTags {


public static class Blocks {

public static final TagKey<Block> AETHER_GRASS_NONREPLACING = tag("aether_grass_nonreplacing");

public static TagKey<Block> tag(String name) {
return TagKey.create(Registries.BLOCK, Redux.loc(name));
}
}

public static class Items {

public static TagKey<Item> tag(String name) {
return TagKey.create(Registries.ITEM, Redux.loc(name));
}
}

public static class Entities {

private static TagKey<EntityType<?>> tag(String name) {
return TagKey.create(Registries.ENTITY_TYPE, Redux.loc(name));
}
}

public static class Biomes {

private static TagKey<Biome> tag(String name) {
return TagKey.create(Registries.BIOME, Redux.loc(name));
}
}

public static class DmgTypes {

private static TagKey<DamageType> tag(String name) {
return TagKey.create(Registries.DAMAGE_TYPE, Redux.loc(name));
}
}

public static class Sounds {

private static TagKey<SoundEvent> tag(String name) {
return TagKey.create(Registries.SOUND_EVENT, Redux.loc(name));
}
}

public static class AdvancementSFX {

private static TagKey<AdvancementSoundOverride> tag(String name) {
return TagKey.create(AetherAdvancementSoundOverrides.ADVANCEMENT_SOUND_OVERRIDE_REGISTRY_KEY, Redux.loc(name));
}
}
}

0 comments on commit 8ef0675

Please sign in to comment.