Skip to content
Open

Fabric #1128

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
// see https://fabricmc.net/develop/ for new versions
id 'fabric-loom' version '1.9-SNAPSHOT' apply false
id 'fabric-loom' version '1.13-SNAPSHOT' apply false
// see https://projects.neoforged.net/neoforged/moddevgradle for new versions
id 'net.neoforged.moddev' version '2.0.49-beta' apply false
}
id 'net.neoforged.moddev' version '2.0.140' apply false
}
5 changes: 5 additions & 0 deletions buildSrc/src/main/groovy/multiloader-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ repositories {
name = 'BlameJared'
url = 'https://maven.blamejared.com'
}

maven {
name = "Fuzs Mod Resources"
url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
}
}

// Declare capabilities on the outgoing configurations.
Expand Down
3 changes: 3 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ neoForge {
}
}



dependencies {
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
// fabric and neoforge both bundle mixinextras, so it is safe to use it in common
compileOnly group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.3.5'
annotationProcessor group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.3.5'
compileOnly "fuzs.forgeconfigapiport:forgeconfigapiport-common-neoforgeapi:${project.forge_config_api_port_version}"
}

configurations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import com.dtteam.dynamictrees.block.leaves.DynamicLeavesBlock;
import com.dtteam.dynamictrees.block.leaves.LeavesProperties;
import com.dtteam.dynamictrees.block.pod.OffsetablePodBlock;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.systems.GrowSignal;
import com.dtteam.dynamictrees.systems.cell.MetadataCell;
import com.dtteam.dynamictrees.systems.growthlogic.context.DirectionSelectionContext;
Expand Down Expand Up @@ -192,8 +191,8 @@ public boolean canPlaceLiquid(@Nullable Player player, BlockGetter level, BlockP
public float getHardness(BlockState state, BlockGetter level, BlockPos pos) {
final int radius = this.getRadius(level.getBlockState(pos));
final double hardness = this.getFamily().getPrimitiveLog().orElse(Blocks.AIR).defaultBlockState()
.getDestroySpeed(level, pos) * Services.CONFIG.getDoubleConfig(IConfigHelper.TREE_HARDNESS_MULTIPLIER) * (radius * radius) / 64.0f * 8.0f;
return (float) Math.min(hardness, Services.CONFIG.getDoubleConfig(IConfigHelper.MAX_TREE_HARDNESS)); // So many youtube let's plays start with "OMG, this is taking so long to break this tree!"
.getDestroySpeed(level, pos) * DTConfigs.SERVER.treeHardnessMultiplier.get() * (radius * radius) / 64.0f * 8.0f;
return (float) Math.min(hardness, DTConfigs.SERVER.maxTreeHardness.get());
}

/** NeoForge override */
Expand Down Expand Up @@ -370,7 +369,7 @@ public GrowSignal growSignal(Level level, BlockPos pos, GrowSignal signal) {
/** NeoForge Override */
@SuppressWarnings("unused")
public boolean isLadder(BlockState state, LevelReader level, BlockPos pos, LivingEntity entity) {
return Services.CONFIG.getBoolConfig(IConfigHelper.ENABLE_BRANCH_CLIMBING) &&
return DTConfigs.SERVER.enableBranchClimbing.get() &&
entity instanceof Player &&
getFamily().branchIsLadder() &&
(!state.hasProperty(WATERLOGGED) || !state.getValue(WATERLOGGED));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import com.dtteam.dynamictrees.block.soil.AerialRootsSoilProperties;
import com.dtteam.dynamictrees.block.soil.SoilBlock;
import com.dtteam.dynamictrees.entity.FallingTreeEntity;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.loot.LootTableSupplier;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.systems.GrowSignal;
import com.dtteam.dynamictrees.systems.growthlogic.context.DirectionSelectionContext;
import com.dtteam.dynamictrees.systems.nodemapper.NetVolumeNode;
Expand Down Expand Up @@ -411,8 +410,8 @@ public float getHardness(BlockState state, BlockGetter level, BlockPos pos) {
if (isFullBlock(state)) return getFamily().getPrimitiveCoveredRoots().orElse(Blocks.AIR).defaultDestroyTime();
final int radius = this.getRadius(level.getBlockState(pos));
final double hardness = this.getFamily().getPrimitiveLog().orElse(Blocks.AIR).defaultBlockState()
.getDestroySpeed(level, pos) * Services.CONFIG.getDoubleConfig(IConfigHelper.TREE_HARDNESS_MULTIPLIER) * (radius * radius) / 64.0f * 8.0f;
return (float) Math.min(hardness, Services.CONFIG.getDoubleConfig(IConfigHelper.MAX_TREE_HARDNESS)); // So many youtube let's plays start with "OMG, this is taking so long to break this tree!"
.getDestroySpeed(level, pos) * DTConfigs.SERVER.treeHardnessMultiplier.get() * (radius * radius) / 64.0f * 8.0f;
return (float) Math.min(hardness, DTConfigs.SERVER.maxTreeHardness.get());
}

//This is the state that will replace the root when the tree is felled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import com.dtteam.dynamictrees.block.soil.SoilBlock;
import com.dtteam.dynamictrees.data.DTLootTableBuilder;
import com.dtteam.dynamictrees.entity.FallingTreeEntity;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.loot.LootTableSupplier;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.platform.*;
import com.dtteam.dynamictrees.systems.FutureBreak;
import com.dtteam.dynamictrees.systems.nodemapper.DestroyerNode;
import com.dtteam.dynamictrees.systems.nodemapper.NetVolumeNode;
Expand Down Expand Up @@ -631,7 +631,7 @@ protected void sloppyBreak(Level level, BlockPos cutPos, FallingTreeEntity.Destr
final List<ItemStack> woodDropList = destroyData.species.getBranchesDrops(level, destroyData.woodVolume);

// If sloppy break drops are off clear all drops.
if (!Services.CONFIG.getBoolConfig(IConfigHelper.SLOPPY_BREAK_DROPS)) {
if (!DTConfigs.SERVER.sloppyBreakDrops.get()) {
destroyData.leavesDrops.clear();
woodDropList.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
import com.dtteam.dynamictrees.api.worldgen.LevelContext;
import com.dtteam.dynamictrees.block.DynamicBlockProperties;
import com.dtteam.dynamictrees.block.Growable;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.data.DTLootTableBuilder;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.systems.season.SeasonHelper;
import com.dtteam.dynamictrees.treepack.Resettable;
import com.dtteam.dynamictrees.utility.ResourceLocationUtils;
Expand Down Expand Up @@ -304,7 +303,7 @@ public LootTable.Builder createBlockDrops(HolderLookup.Provider registries) {
@NotNull
@Override
public Fruit reset() {
canBoneMeal = Services.CONFIG.isServerConfigLoaded() && Services.CONFIG.getBoolConfig(IConfigHelper.CAN_BONE_MEAL_FRUIT);
canBoneMeal = DTConfigs.SERVER_CONFIG.isLoaded() && DTConfigs.SERVER.canBoneMealFruit.get();
requiredProductionFactor = 0.3F;
matureAction = Growable.MatureAction.DEFAULT;
seasonalFactorGetter = (l,b)-> 1.0f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import com.dtteam.dynamictrees.data.tags.DTEntityTypeTags;
import com.dtteam.dynamictrees.item.Seed;
import com.dtteam.dynamictrees.loot.DTLootContextParams;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.systems.GrowSignal;
import com.dtteam.dynamictrees.tree.ChunkTreeHelper;
import com.dtteam.dynamictrees.tree.TreeHelper;
Expand Down Expand Up @@ -123,7 +123,7 @@ public int age(LevelAccessor level, BlockPos pos, BlockState state, RandomSource
*/
@Override
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource rand) {
double growthMultiplier = Services.CONFIG.getDoubleConfig(IConfigHelper.TREE_GROWTH_MULTIPLIER);
double growthMultiplier = DTConfigs.SERVER.treeGrowthMultiplier.get();
if (rand.nextFloat() > growthMultiplier) {
return;
}
Expand Down Expand Up @@ -545,11 +545,11 @@ public VoxelShape getBlockSupportShape(BlockState pState, BlockGetter pReader, B
}

protected boolean isMovementVanilla(){
return Services.CONFIG.isServerConfigLoaded() && Services.CONFIG.getBoolConfig(IConfigHelper.VANILLA_LEAVES_COLLISION);
return DTConfigs.SERVER_CONFIG.isLoaded() && DTConfigs.SERVER.vanillaLeavesCollision.get();
}

protected boolean isLeavesPassable() {
return (Services.CONFIG.isServerConfigLoaded() && Services.CONFIG.getBoolConfig(IConfigHelper.IS_LEAVES_PASSABLE))
return (DTConfigs.SERVER_CONFIG.isLoaded() && DTConfigs.SERVER.isLeavesPassable.get())
|| Services.PLATFORM.isModLoaded(DynamicTrees.PASSABLE_FOLIAGE);
}

Expand Down Expand Up @@ -580,8 +580,7 @@ protected void superFallOn(Level level, BlockState blockState, BlockPos pos, Ent

@Override
public void fallOn(Level level, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
// We are only interested in Living things crashing through the canopy.
if (!Services.CONFIG.getBoolConfig(IConfigHelper.ENABLE_CANOPY_CRASH) || !(entity instanceof LivingEntity)) {
if (!DTConfigs.SERVER.enableCanopyCrash.get() || !(entity instanceof LivingEntity)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,23 +655,23 @@ public void setColorString(String colorString) {
this.colorString = colorString;
}

//@OnlyIn(Dist.CLIENT)
//
private BlockColor colorMultiplier;

//@OnlyIn(Dist.CLIENT)
//
public int treeFallColorMultiplier(BlockState state, BlockAndTintGetter level, BlockPos pos) {
return this.foliageColorMultiplier(state, level, pos);
}

//@OnlyIn(Dist.CLIENT)
//
public int foliageColorMultiplier(BlockState state, BlockAndTintGetter level, BlockPos pos) {
if (colorMultiplier == null) {
return 0x00FF00FF; //purple if broken
}
return colorMultiplier.getColor(state, level, pos, -1);
}

// @OnlyIn(Dist.CLIENT)
//
private void processColor() {
int color = -1;
if (this.colorNumber != null) {
Expand Down Expand Up @@ -700,7 +700,7 @@ private void processColor() {
this.colorMultiplier = (s, w, p, t) -> c == -1 ? Minecraft.getInstance().getBlockColors().getColor(getPrimitiveLeaves(), w, p, 0) : c;
}

//@OnlyIn(Dist.CLIENT)
//
public static void postInitClient() {
REGISTRY.getAll().forEach(LeavesProperties::processColor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
import com.dtteam.dynamictrees.api.worldgen.LevelContext;
import com.dtteam.dynamictrees.block.DynamicBlockProperties;
import com.dtteam.dynamictrees.block.Growable;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.data.DTLootTableBuilder;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.treepack.Resettable;
import com.dtteam.dynamictrees.utility.ResourceLocationUtils;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -362,7 +361,7 @@ public IntegerProperty getOffsetProperty (){
@NotNull
@Override
public Pod reset() {
canBoneMeal = Services.CONFIG.isServerConfigLoaded() && Services.CONFIG.getBoolConfig(IConfigHelper.CAN_BONE_MEAL_PODS);
canBoneMeal = DTConfigs.SERVER_CONFIG.isLoaded() && DTConfigs.SERVER.canBoneMealPods.get();
requiredProductionFactor = 0.3F;
matureAction = Growable.MatureAction.DEFAULT;
seasonalFactorGetter = (l,b)-> 1.0f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.dtteam.dynamictrees.block.sapling;

import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.tree.TreeHelper;
import com.dtteam.dynamictrees.tree.species.Species;
import com.dtteam.dynamictrees.utility.CoordUtils;
Expand Down Expand Up @@ -145,8 +144,7 @@ public ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState s

@Override
public List<ItemStack> getDrops(@NotNull BlockState state, @NotNull LootParams.Builder builder) {
// Drop nothing if sapling drops are disabled, nuthin'!
if (!Services.CONFIG.getBoolConfig(IConfigHelper.DYNAMIC_SAPLING_DROPS))
if (!DTConfigs.SERVER.dynamicSaplingDrops.get())
return Collections.emptyList();
// If a loot table has been added load those drops instead.
LootTable loottable = builder.getLevel().getServer().reloadableRegistries().getLootTable(getLootTable());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import com.dtteam.dynamictrees.api.treedata.TreePart;
import com.dtteam.dynamictrees.block.BlockWithDynamicHardness;
import com.dtteam.dynamictrees.block.branch.BranchBlock;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.data.tags.DTBlockTags;
import com.dtteam.dynamictrees.entity.FallingTreeEntity;
import com.dtteam.dynamictrees.entity.animation.FalloverAnimationHandler;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.entity.animation.*;
import com.dtteam.dynamictrees.systems.nodemapper.NetVolumeNode;
import com.dtteam.dynamictrees.systems.nodemapper.RootIntegrityNode;
import com.dtteam.dynamictrees.tree.ChunkTreeHelper;
Expand Down Expand Up @@ -142,7 +141,7 @@ public float getHardness(BlockState state, BlockGetter level, BlockPos pos) {
if (up.getBlock() instanceof BlockWithDynamicHardness upBlock){
hardness = upBlock.getHardness(up, level, pos.above());
}
return (float)(hardness * Services.CONFIG.getDoubleConfig(IConfigHelper.ROOTY_BLOCK_HARDNESS_MULTIPLIER));
return (float)(hardness * DTConfigs.SERVER.rootyBlockHardnessMultiplier.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
import com.dtteam.dynamictrees.block.branch.BasicRootsBlock;
import com.dtteam.dynamictrees.block.branch.BranchBlock;
import com.dtteam.dynamictrees.block.leaves.LeavesProperties;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.entity.FallingTreeEntity;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.systems.GrowSignal;
import com.dtteam.dynamictrees.tree.ChunkTreeHelper;
import com.dtteam.dynamictrees.tree.TreeHelper;
Expand Down Expand Up @@ -167,7 +166,7 @@ public ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState s

@Override
public float getHardness(BlockState state, BlockGetter level, BlockPos pos) {
return (float) (getPrimitiveSoilState(state).getDestroySpeed(level, pos) * Services.CONFIG.getDoubleConfig(IConfigHelper.ROOTY_BLOCK_HARDNESS_MULTIPLIER));
return (float) (getPrimitiveSoilState(state).getDestroySpeed(level, pos) * DTConfigs.SERVER.rootyBlockHardnessMultiplier.get());
}

///////////////////////////////////////////
Expand Down Expand Up @@ -207,7 +206,7 @@ public boolean hasTileEntity(BlockState state) {

@Override
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
double growthMultiplier = Services.CONFIG.getDoubleConfig(IConfigHelper.TREE_GROWTH_MULTIPLIER);
double growthMultiplier = DTConfigs.SERVER.treeGrowthMultiplier.get();
//Growth multiplier lower than 1 causes only some ticks to grow
if (random.nextFloat() > growthMultiplier) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import com.dtteam.dynamictrees.DynamicTrees;
import com.dtteam.dynamictrees.api.registry.TypedRegistry;
import com.dtteam.dynamictrees.block.branch.BranchBlock;
import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.services.IConfigHelper;
import com.dtteam.dynamictrees.config.DTConfigs;
import com.dtteam.dynamictrees.tree.TreeHelper;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
Expand Down Expand Up @@ -87,7 +86,7 @@ public ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState s

@Override
public float getHardness(BlockState state, BlockGetter level, BlockPos pos) {
return (float) (0.5 * Services.CONFIG.getDoubleConfig(IConfigHelper.ROOTY_BLOCK_HARDNESS_MULTIPLIER));
return (float) (0.5 * DTConfigs.SERVER.rootyBlockHardnessMultiplier.get());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.HashMap;
import java.util.Map;

//@OnlyIn(Dist.CLIENT)
//
public class BlockColorMultipliers {

private static Map<ResourceLocation, BlockColor> colorBase = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.util.HashMap;
import java.util.Map;

//@OnlyIn(Dist.CLIENT)
//
public class SoundInstanceHandler {

private static final Map<Integer, SoundInstance> instances = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dtteam.dynamictrees.client;

import com.dtteam.dynamictrees.platform.Services;
import com.dtteam.dynamictrees.platform.ClientServices;
import com.mojang.blaze3d.platform.NativeImage;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;

Expand Down Expand Up @@ -37,7 +37,7 @@ public PixelBuffer(TextureAtlasSprite sprite) {
pixels = new int[w * h];
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
pixels[calcPos(x, y)] = Services.MISC.getPixelRGBA(sprite, x, y);
pixels[calcPos(x, y)] = ClientServices.CLIENT.getPixelRGBA(sprite, x, y);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import net.minecraft.client.resources.metadata.animation.FrameSize;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)

public class ThickBranchRingsSprite extends SpriteContents {
private static final int RESOLUTION = 16;
private static final int LAYERS = 3;
Expand All @@ -18,7 +16,7 @@ public class ThickBranchRingsSprite extends SpriteContents {
};

public ThickBranchRingsSprite(ResourceLocation name, SpriteContents originalSprite){
super(name, getFrameSize(originalSprite), processImage(originalSprite.originalImage), originalSprite.metadata);
super(name, getFrameSize(originalSprite), processImage(originalSprite.originalImage), originalSprite.metadata());
}

private static FrameSize getFrameSize(SpriteContents sprite){
Expand Down
Loading