Skip to content

Commit

Permalink
Rename to ConfigRegistry pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
WenXin20 committed Sep 6, 2024
1 parent bc24cbd commit 47c5a2f
Show file tree
Hide file tree
Showing 15 changed files with 153 additions and 153 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/wenxin2/marioverse/Marioverse.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.wenxin2.marioverse.event_handlers.MarioverseEventHandlers;
import com.wenxin2.marioverse.init.BlockEntityRegistry;
import com.wenxin2.marioverse.init.BlockRegistry;
import com.wenxin2.marioverse.init.Config;
import com.wenxin2.marioverse.init.ConfigRegistry;
import com.wenxin2.marioverse.init.MarioverseCreativeTabs;
import com.wenxin2.marioverse.init.MenuRegistry;
import com.wenxin2.marioverse.init.ItemRegistry;
Expand Down Expand Up @@ -57,11 +57,11 @@ public Marioverse(IEventBus bus, Dist dist, ModContainer container)
ItemRegistry.init();
MenuRegistry.init();
SoundRegistry.init();
Config.register(container);
ConfigRegistry.register(container);

if (dist.isClient()) {
// bus.addListener(ClientSetupHandler::registerBlockEntityRenderers);
Config.registerClient(container);
ConfigRegistry.registerClient(container);
}

// WarpEventHandlers.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.common.collect.Maps;
import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity;
import com.wenxin2.marioverse.init.BlockRegistry;
import com.wenxin2.marioverse.init.Config;
import com.wenxin2.marioverse.init.ConfigRegistry;
import com.wenxin2.marioverse.init.ModTags;
import com.wenxin2.marioverse.items.LinkerItem;
import java.util.Collection;
Expand Down Expand Up @@ -198,7 +198,7 @@ public VoxelShape noCollisionShape(BlockState state, CollisionContext context) {
(state.getValue(UP) && state.getValue(DOWN) && state.getValue(NORTH) && state.getValue(SOUTH) && state.getValue(EAST) &&
state.getValue(ENTRANCE) && state.getValue(FACING) == Direction.WEST)) {

if ((player.isCreative() && Config.DEBUG_SELECTION_BOX_CREATIVE.get() || Config.DEBUG_SELECTION_BOX.get())
if ((player.isCreative() && ConfigRegistry.DEBUG_SELECTION_BOX_CREATIVE.get() || ConfigRegistry.DEBUG_SELECTION_BOX.get())
|| ((player.getItemInHand(player.getUsedItemHand()).getItem() instanceof BucketItem
|| player.getItemInHand(player.getUsedItemHand()).getItem() instanceof LinkerItem
|| player.getItemInHand(player.getUsedItemHand()).getItem() instanceof DebugStickItem
Expand All @@ -212,7 +212,7 @@ public VoxelShape noCollisionShape(BlockState state, CollisionContext context) {
if (!state.getValue(ENTRANCE) && state.getValue(UP) && state.getValue(DOWN) && state.getValue(NORTH)
&& state.getValue(SOUTH) && state.getValue(EAST) && state.getValue(WEST)) {

if ((player.isCreative() && Config.DEBUG_SELECTION_BOX_CREATIVE.get() || Config.DEBUG_SELECTION_BOX.get())
if ((player.isCreative() && ConfigRegistry.DEBUG_SELECTION_BOX_CREATIVE.get() || ConfigRegistry.DEBUG_SELECTION_BOX.get())
|| ((player.getItemInHand(player.getUsedItemHand()).getItem() instanceof BucketItem
|| player.getItemInHand(player.getUsedItemHand()).getItem() instanceof LinkerItem
|| player.getItemInHand(player.getUsedItemHand()).getItem() instanceof DebugStickItem
Expand Down Expand Up @@ -416,13 +416,13 @@ public void entityInside(BlockState state, Level world, BlockPos pos, Entity ent
int blockY = pos.getY();
int blockZ = pos.getZ();

if (!entity.isShiftKeyDown() && Config.ALLOW_FAST_TRAVEL.get() && !entity.getType().is(ModTags.QUICK_TRAVEL_BLACKLIST))
if (!entity.isShiftKeyDown() && ConfigRegistry.ALLOW_FAST_TRAVEL.get() && !entity.getType().is(ModTags.QUICK_TRAVEL_BLACKLIST))
entity.setSwimming(true);

if ((entityY < blockY + 0.98 && entityY > blockY + 0.02)
&& (entityX < blockX + 0.98 && entityX > blockX + 0.02)
&& (entityZ < blockZ + 0.98 && entityZ > blockZ + 0.02)
&& !entity.isShiftKeyDown() && Config.ALLOW_FAST_TRAVEL.get()
&& !entity.isShiftKeyDown() && ConfigRegistry.ALLOW_FAST_TRAVEL.get()
&& !entity.getType().is(ModTags.QUICK_TRAVEL_BLACKLIST)) {
this.moveEntityInPipe(entity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity;
import com.wenxin2.marioverse.init.BlockRegistry;
import com.wenxin2.marioverse.init.Config;
import com.wenxin2.marioverse.init.ConfigRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.ParticleOptions;
Expand Down Expand Up @@ -54,7 +54,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
@Override
public VoxelShape getShape(BlockState state, BlockGetter blockGetter, BlockPos pos, CollisionContext context) {
if (context instanceof EntityCollisionContext && ((EntityCollisionContext)context).getEntity() instanceof Player player
&& player.hasPermissions(1) && player.isCreative() && Config.DEBUG_PIPE_BUBBLES_SELECTION_BOX.get()) {
&& player.hasPermissions(1) && player.isCreative() && ConfigRegistry.DEBUG_PIPE_BUBBLES_SELECTION_BOX.get()) {
return Shapes.block();
}
// Shapes.empty() causes a crash, use a tiny bounding box instead
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.wenxin2.marioverse.blocks;

import com.wenxin2.marioverse.blocks.entities.QuestionBlockEntity;
import com.wenxin2.marioverse.init.Config;
import com.wenxin2.marioverse.init.ConfigRegistry;
import com.wenxin2.marioverse.init.ModTags;
import com.wenxin2.marioverse.init.SoundRegistry;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -78,15 +78,15 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev

if (blockEntity instanceof QuestionBlockEntity questionBlockEntity) {
ItemStack blockStack = questionBlockEntity.getStackInSlot();
if (!heldItem.isEmpty() && (Config.QUESTION_ADD_ITEMS.get() || player.isCreative())
if (!heldItem.isEmpty() && (ConfigRegistry.QUESTION_ADD_ITEMS.get() || player.isCreative())
&& (blockStack.isEmpty() || ItemStack.isSameItemSameComponents(heldItem, blockStack))) {
world.setBlock(pos, state.setValue(QuestionBlock.EMPTY, Boolean.FALSE), 3);
questionBlockEntity.addItem(heldItem);
questionBlockEntity.setChanged();
if(!player.isCreative())
stack.shrink(heldItem.getCount());
return ItemInteractionResult.SUCCESS;
} else if (heldItem.isEmpty() && (Config.QUESTION_REMOVE_ITEMS.get() || player.isCreative())) {
} else if (heldItem.isEmpty() && (ConfigRegistry.QUESTION_REMOVE_ITEMS.get() || player.isCreative())) {
ItemStack droppedItem = questionBlockEntity.getItems().getStackInSlot(0);

if (!droppedItem.isEmpty()) {
Expand All @@ -110,7 +110,7 @@ protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Lev
}

public void spawnEntity(Level world, Entity entity, BlockPos pos, ItemStack stack, Boolean dropEntireStack) {
if (stack.getItem() instanceof SpawnEggItem spawnEgg && Config.QUESTION_SPAWNS_MOBS.get()) {
if (stack.getItem() instanceof SpawnEggItem spawnEgg && ConfigRegistry.QUESTION_SPAWNS_MOBS.get()) {
EntityType<?> entityType = spawnEgg.getType(stack);

if (world instanceof ServerLevel serverWorld && !entityType.is(ModTags.QUESTION_BLOCK_BLACKLIST)) { // Check this
Expand Down
36 changes: 18 additions & 18 deletions src/main/java/com/wenxin2/marioverse/blocks/WarpPipeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.serialization.MapCodec;
import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity;
import com.wenxin2.marioverse.init.Config;
import com.wenxin2.marioverse.init.ConfigRegistry;
import com.wenxin2.marioverse.init.ItemRegistry;
import com.wenxin2.marioverse.init.SoundRegistry;
import com.wenxin2.marioverse.integration.CompatRegistry;
Expand Down Expand Up @@ -132,8 +132,8 @@ public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level
pipeBlockEntity.markUpdated();
isSuccesful = true;
}
} else if (item == Items.HONEYCOMB && (Config.WAX_DISABLES_BUBBLES.get() || Config.WAX_DISABLES_CLOSING.get()
|| Config.WAX_DISABLES_RENAMING.get() || Config.WAX_DISABLES_WATER_SPOUTS.get())) {
} else if (item == Items.HONEYCOMB && (ConfigRegistry.WAX_DISABLES_BUBBLES.get() || ConfigRegistry.WAX_DISABLES_CLOSING.get()
|| ConfigRegistry.WAX_DISABLES_RENAMING.get() || ConfigRegistry.WAX_DISABLES_WATER_SPOUTS.get())) {
pipeBlockEntity.setWaxed(Boolean.TRUE);
world.playSound(player, pos, SoundEvents.HONEYCOMB_WAX_ON, SoundSource.BLOCKS, 1.0F, 1.0F);
ParticleUtils.spawnParticlesOnBlockFaces(world, pos, ParticleTypes.WAX_ON, UniformInt.of(3, 5));
Expand Down Expand Up @@ -215,7 +215,7 @@ public ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level
isSuccesful = true;
}
}
} else if (Config.ALLOW_PIPE_UNWAXING.get() && (stack.is(ItemTags.AXES) || item instanceof AxeItem)) {
} else if (ConfigRegistry.ALLOW_PIPE_UNWAXING.get() && (stack.is(ItemTags.AXES) || item instanceof AxeItem)) {
pipeBlockEntity.setWaxed(Boolean.FALSE);
world.playSound(null, pos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
ParticleUtils.spawnParticlesOnBlockFaces(world, pos, ParticleTypes.WAX_OFF, UniformInt.of(3, 5));
Expand Down Expand Up @@ -610,12 +610,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (state.getBlock() instanceof ClearWarpPipeBlock && !state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY() - 1.0, warpPos.getZ() + 0.5);
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 1, 0));
} else {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY() - 1.0, warpPos.getZ() + 0.5);
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 1, 0));
entity.unRide();
}
Expand All @@ -624,12 +624,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (world.getBlockState(warpPos).getValue(FACING) == Direction.UP && state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY() + 1.0, warpPos.getZ() + 0.5);
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
} else {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY() + 1.0, warpPos.getZ() + 0.5);
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
entity.unRide();
}
Expand All @@ -638,12 +638,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (world.getBlockState(warpPos).getValue(FACING) == Direction.DOWN && state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY() - entity.getBbHeight(), warpPos.getZ() + 0.5);
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
} else {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY() - entity.getBbHeight(), warpPos.getZ() + 0.5);
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
entity.unRide();
}
Expand All @@ -652,12 +652,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (world.getBlockState(warpPos).getValue(FACING) == Direction.NORTH && state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY(), warpPos.getZ() - entity.getBbWidth());
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
} else {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY(), warpPos.getZ() - entity.getBbWidth());
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
entity.unRide();
}
Expand All @@ -666,12 +666,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (world.getBlockState(warpPos).getValue(FACING) == Direction.SOUTH && state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY(), warpPos.getZ() + entity.getBbWidth() + 1.0);
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
} else {
entity.teleportTo(warpPos.getX() + 0.5, warpPos.getY(), warpPos.getZ() + entity.getBbWidth() + 1.0);
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
entity.unRide();
}
Expand All @@ -680,12 +680,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (world.getBlockState(warpPos).getValue(FACING) == Direction.EAST && state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() + entity.getBbWidth() + 1.0, warpPos.getY(), warpPos.getZ() + 0.5);
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
} else {
entity.teleportTo(warpPos.getX() + entity.getBbWidth() + 1.0, warpPos.getY(), warpPos.getZ() + 0.5);
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
entity.unRide();
}
Expand All @@ -694,12 +694,12 @@ public static void warp(Entity entity, BlockPos warpPos, Level world, BlockState
if (world.getBlockState(warpPos).getValue(FACING) == Direction.WEST && state.getValue(ENTRANCE)) {
if (entity instanceof Player) {
entity.teleportTo(warpPos.getX() - entity.getBbWidth(), warpPos.getY(), warpPos.getZ() + 0.5);
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) entity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
} else {
entity.teleportTo(warpPos.getX() - entity.getBbWidth(), warpPos.getY(), warpPos.getZ() + 0.5);
if (passengerEntity instanceof Player) {
if (Config.BLINDNESS_EFFECT.get())
if (ConfigRegistry.BLINDNESS_EFFECT.get())
((Player) passengerEntity).addEffect(new MobEffectInstance(MobEffects.BLINDNESS, 20, 0, true, false));
entity.unRide();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.wenxin2.marioverse.blocks.entities.WarpPipeBlockEntity;
import com.wenxin2.marioverse.init.BlockRegistry;
import com.wenxin2.marioverse.init.Config;
import com.wenxin2.marioverse.init.ConfigRegistry;
import java.util.Optional;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -60,9 +60,9 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
@Override
public VoxelShape getShape(BlockState state, BlockGetter blockGetter, BlockPos pos, CollisionContext context) {
if (context instanceof EntityCollisionContext && ((EntityCollisionContext) context).getEntity() instanceof Player player) {
if ((player.hasPermissions(1) && player.isCreative() && Config.DEBUG_WATER_SPOUT_SELECTION_BOX.get())
if ((player.hasPermissions(1) && player.isCreative() && ConfigRegistry.DEBUG_WATER_SPOUT_SELECTION_BOX.get())
|| (((player.getItemInHand(player.getUsedItemHand()).getItem() instanceof BucketItem
&& Config.WATER_SPOUTS_BUCKETABLE.get())
&& ConfigRegistry.WATER_SPOUTS_BUCKETABLE.get())
|| player.getItemInHand(player.getUsedItemHand()).getItem() instanceof DebugStickItem))) {
if (state.getValue(TOP)) {
return SPOUT_TOP;
Expand Down Expand Up @@ -278,7 +278,7 @@ public static void repeatColumnUp(LevelAccessor worldAccessor, BlockPos pos, Blo

@Override
public ItemStack pickupBlock(@Nullable Player player, LevelAccessor worldAccessor, BlockPos pos, BlockState state) {
if (Config.WATER_SPOUTS_BUCKETABLE.get()) {
if (ConfigRegistry.WATER_SPOUTS_BUCKETABLE.get()) {
worldAccessor.setBlock(pos, Blocks.AIR.defaultBlockState(), 3);
return new ItemStack(Items.WATER_BUCKET);
} else return ItemStack.EMPTY;
Expand Down
Loading

0 comments on commit 47c5a2f

Please sign in to comment.