Skip to content

Commit

Permalink
structure building mode & bump to 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Nov 11, 2024
1 parent 592eb71 commit 8a3426c
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ loader_version=0.16.0

# Mod Properties
mod_id = trailiertales
mod_version = 1.0.5
mod_version = 1.1
# protocol version must be changed after each update with dual env changes
protocol_version = 1
maven_group = net.frozenblock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package net.frozenblock.trailiertales;

import java.nio.file.Path;
Expand All @@ -7,6 +6,7 @@

public class TTPreLoadConstants {
public static final String MOD_ID = "trailiertales";
public static final boolean STRUCTURE_BUILDING_MODE = true; // Only enable this while building structures.

@Contract(pure = true)
public static @NotNull Path configPath(String name, boolean json5) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.frozenblock.trailiertales.TTPreLoadConstants;
import net.frozenblock.trailiertales.block.entity.SurveyorBlockEntity;
import net.frozenblock.trailiertales.registry.TTBlockEntityTypes;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -88,6 +89,8 @@ protected int getDirectSignal(@NotNull BlockState state, BlockGetter level, Bloc

@Override
protected int getSignal(@NotNull BlockState state, BlockGetter level, BlockPos pos, Direction direction) {
if (TTPreLoadConstants.STRUCTURE_BUILDING_MODE) return 0;

return state.getValue(POWERED) && state.getValue(FACING) == direction ? 15 : 0;
}

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

import java.util.List;
import java.util.Optional;
import net.frozenblock.trailiertales.TTPreLoadConstants;
import net.frozenblock.trailiertales.block.SurveyorBlock;
import net.frozenblock.trailiertales.registry.TTBlockEntityTypes;
import net.frozenblock.trailiertales.tag.TTEntityTags;
Expand Down Expand Up @@ -72,6 +73,8 @@ protected void saveAdditional(CompoundTag nbt, HolderLookup.Provider lookupProvi
}

public void tickServer(ServerLevel serverLevel, BlockPos pos, BlockState state) {
if (TTPreLoadConstants.STRUCTURE_BUILDING_MODE) return;

if (this.detectionCooldown <= 0) {
this.detectionCooldown = 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.Set;
import net.frozenblock.lib.FrozenBools;
import net.frozenblock.trailiertales.TTPreLoadConstants;
import net.frozenblock.trailiertales.config.TTMixinsConfig;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -40,7 +41,7 @@ public boolean shouldApplyMixin(String targetClassName, @NotNull String mixinCla
if (mixinClassName.contains("surveyor.")) return this.mixinsConfig.surveyor;

if (mixinClassName.contains("datagen.")) return FrozenBools.IS_DATAGEN;

if (mixinClassName.contains("structure_building.")) return TTPreLoadConstants.STRUCTURE_BUILDING_MODE;
return true;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.frozenblock.trailiertales.mixin.structure_building.common;

import net.minecraft.world.level.block.CandleBlock;
import net.minecraft.world.level.block.state.BlockBehaviour;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(CandleBlock.class)
public class CandleBlockMixin {

@Inject(method = "<init>", at = @At("TAIL"))
public void trailierTales$init(BlockBehaviour.Properties settings, CallbackInfo info) {
CandleBlock candleBlock = CandleBlock.class.cast(this);
candleBlock.registerDefaultState(candleBlock.defaultBlockState().setValue(CandleBlock.CANDLES, CandleBlock.MAX_CANDLES));
}

}
3 changes: 2 additions & 1 deletion src/main/resources/trailiertales.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"common.dawntrail.ShearsDispenseItemBehaviorMixin",
"common.decorated_pot.DecoratedPotBlockEntityMixin",
"common.surveyor.RedStoneWireBlockMixin",
"datagen.common.feature_flag.FeatureFlagsMixin"
"datagen.common.feature_flag.FeatureFlagsMixin",
"structure_building.common.CandleBlockMixin"
],
"client": [
"client.boat.BoatRendererMixin",
Expand Down

0 comments on commit 8a3426c

Please sign in to comment.