Skip to content

Commit

Permalink
Update to Minecraft 1.21.2/3.
Browse files Browse the repository at this point in the history
- Update to Minecraft 1.21.2/3
* Reorg lang files for consistency
* Follow Terraform boat API changes
* Drop unused TerraBlender support files
  • Loading branch information
gniftygnome committed Nov 10, 2024
1 parent 32c4e9c commit bb276bb
Show file tree
Hide file tree
Showing 46 changed files with 4,056 additions and 1,221 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ public void onInitializeClient() {
}

private void registerEntityRenderers() {
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "redwood"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "hemlock"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "rubber"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "cypress"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "willow"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "japanese_maple"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "rainbow_eucalyptus"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "sakura"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "yucca_palm"), false);
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "redwood"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "hemlock"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "rubber"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "cypress"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "willow"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "japanese_maple"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "rainbow_eucalyptus"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "sakura"));
TerraformBoatClientHelper.registerModelLayers(Identifier.of(Terrestria.MOD_ID, "yucca_palm"));
}

private void addColoredGrass(Block grass) {
Expand Down
3 changes: 2 additions & 1 deletion client/src/main/resources/assets/terrestria/lang/en_gb.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"block.terrestria.chiseled_basalt_bricks": "Chiselled Volcanic Rock Bricks"
"block.terrestria.chiseled_basalt_bricks": "Chiselled Volcanic Rock Bricks",
"item.terrestria.chiseled_basalt_bricks": "Chiselled Volcanic Rock Bricks"
}
318 changes: 284 additions & 34 deletions client/src/main/resources/assets/terrestria/lang/en_us.json

Large diffs are not rendered by default.

277 changes: 251 additions & 26 deletions client/src/main/resources/assets/terrestria/lang/es_ar.json

Large diffs are not rendered by default.

277 changes: 251 additions & 26 deletions client/src/main/resources/assets/terrestria/lang/es_es.json

Large diffs are not rendered by default.

277 changes: 251 additions & 26 deletions client/src/main/resources/assets/terrestria/lang/es_mx.json

Large diffs are not rendered by default.

278 changes: 249 additions & 29 deletions client/src/main/resources/assets/terrestria/lang/fr_fr.json

Large diffs are not rendered by default.

313 changes: 274 additions & 39 deletions client/src/main/resources/assets/terrestria/lang/it_it.json

Large diffs are not rendered by default.

313 changes: 274 additions & 39 deletions client/src/main/resources/assets/terrestria/lang/ko_kr.json

Large diffs are not rendered by default.

276 changes: 250 additions & 26 deletions client/src/main/resources/assets/terrestria/lang/pl_pl.json

Large diffs are not rendered by default.

277 changes: 251 additions & 26 deletions client/src/main/resources/assets/terrestria/lang/pt_br.json

Large diffs are not rendered by default.

309 changes: 267 additions & 42 deletions client/src/main/resources/assets/terrestria/lang/ru_ru.json

Large diffs are not rendered by default.

313 changes: 274 additions & 39 deletions client/src/main/resources/assets/terrestria/lang/uk_ua.json

Large diffs are not rendered by default.

315 changes: 275 additions & 40 deletions client/src/main/resources/assets/terrestria/lang/zh_cn.json

Large diffs are not rendered by default.

720 changes: 472 additions & 248 deletions client/src/main/resources/assets/terrestria/lang/zh_tw.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Terrestria implements ModInitializer {
private static final TerrestriaConfigManager CONFIG_MANAGER = new TerrestriaConfigManager();

private static Boolean initialized = false;
private static final ArrayList<Runnable> runnables = new ArrayList<>(1);
private static final ArrayList<Runnable> RUNNABLES = new ArrayList<>(1);

private static void register() {
// Load the general config if it hasn't been loaded already
Expand Down Expand Up @@ -50,7 +50,7 @@ public void onInitialize() {

// At this point Terrestria is completely initialized.
initialized = true;
for (Runnable callback : runnables) {
for (Runnable callback : RUNNABLES) {
callback.run();
}
}
Expand All @@ -59,7 +59,7 @@ public static void callbackWhenInitialized(Runnable callback) {
if (initialized) {
callback.run();
} else {
runnables.add(callback);
RUNNABLES.add(callback);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ private static GenerationSettings createGenerationSettings(Registerable<Biome> r
DefaultBiomeFeatures.addDefaultMushrooms(builder);
DefaultBiomeFeatures.addDefaultVegetation(builder);
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, OceanPlacedFeatures.SEAGRASS_WARM);
DefaultBiomeFeatures.addSeagrassOnStone(builder);
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public BasaltFlowerBlock(RegistryEntry<StatusEffect> stewEffect, int effectSecon

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
Vec3d vec3d = state.getModelOffset(world, pos);
Vec3d vec3d = state.getModelOffset(pos);
return SHAPE.offset(vec3d.x, vec3d.y, vec3d.z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

public class PricklyDesertPlantBlock extends TerraformDesertPlantBlock implements Fertilizable {
public PricklyDesertPlantBlock(Settings settings) {
super(settings, false);
super(false, settings);
}

public PricklyDesertPlantBlock(Settings settings, boolean onlySand) {
super(settings, onlySand);
public PricklyDesertPlantBlock(boolean onlySand, Settings settings) {
super(onlySand, settings);
}

@Override
Expand Down Expand Up @@ -79,7 +79,9 @@ public void grow(ServerWorld world, Random random, BlockPos pos, BlockState stat

@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
entity.damage(world.getDamageSources().cactus(), 1.0f);
if (world instanceof ServerWorld serverWorld) {
entity.damage(serverWorld, world.getDamageSources().cactus(), 1.0f);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.tick.ScheduledTickView;

public class SaguaroCactusBlock extends BareSmallLogBlock {
public SaguaroCactusBlock(Settings settings) {
super(settings);
}

public static SaguaroCactusBlock of(MapColor color) {
return new SaguaroCactusBlock(AbstractBlock.Settings.create()
public static AbstractBlock.Settings createSettings(MapColor color) {
return AbstractBlock.Settings.create()
.mapColor(color)
.strength(0.4F)
.sounds(BlockSoundGroup.WOOL)
.pistonBehavior(PistonBehavior.DESTROY)
);
.pistonBehavior(PistonBehavior.DESTROY);
}

public static SaguaroCactusBlock of(MapColor flesh, MapColor skin) {
return new SaguaroCactusBlock(AbstractBlock.Settings.create()
public static AbstractBlock.Settings createSettings(MapColor flesh, MapColor skin) {
return AbstractBlock.Settings.create()
.mapColor((state) -> state.get(UP) ? flesh : skin)
.strength(0.4F)
.sounds(BlockSoundGroup.WOOL)
.pistonBehavior(PistonBehavior.DESTROY)
);
.pistonBehavior(PistonBehavior.DESTROY);
}

@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
entity.damage(world.getDamageSources().cactus(), 1.0f);
if (world instanceof ServerWorld serverWorld) {
entity.damage(serverWorld, world.getDamageSources().cactus(), 1.0f);
}
}

@Override
Expand All @@ -59,12 +59,12 @@ public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Ran
}

@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (!isSupported(state, world, pos)) {
world.scheduleBlockTick(pos, this, 1);
public BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) {
if (world instanceof ServerWorld serverWorld && !isSupported(state, world, pos)) {
serverWorld.scheduleBlockTick(pos, this, 1);
}

return super.getStateForNeighborUpdate(state, facing, neighborState, world, pos, neighborPos);
return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random);
}

private boolean isSupportedBlock(BlockState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state) {
BlockPos pos = context.getBlockPos();
World world = context.getWorld();

if (pos.getY() < world.getTopY() && world.getBlockState(pos.up()).canReplace(context)) {
if (pos.getY() < world.getTopYInclusive() && world.getBlockState(pos.up()).canReplace(context)) {
return this.getDefaultState();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
import net.minecraft.world.BlockView;

public class TerraformDesertPlantBlock extends PlantBlock {
public static final MapCodec<TerraformDesertPlantBlock> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(TerraformDesertPlantBlock.createSettingsCodec(), Codec.BOOL.fieldOf("onlySand").forGetter(args -> args.onlySand)).apply(instance, TerraformDesertPlantBlock::new));
public static final MapCodec<TerraformDesertPlantBlock> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(Codec.BOOL.fieldOf("onlySand").forGetter(args -> args.onlySand), TerraformDesertPlantBlock.createSettingsCodec()).apply(instance, TerraformDesertPlantBlock::new));
protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
private final boolean onlySand;

public TerraformDesertPlantBlock(Settings settings) {
this(settings, false);
this(false, settings);
}

public TerraformDesertPlantBlock(Settings settings, boolean onlySand) {
public TerraformDesertPlantBlock(boolean onlySand, Settings settings) {
super(settings.offset(AbstractBlock.OffsetType.XYZ));
this.onlySand = onlySand;
}
Expand All @@ -40,7 +40,7 @@ public boolean canPlantOnTop(BlockState blockState, BlockView blockView, BlockPo

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
Vec3d vec3d = state.getModelOffset(world, pos);
Vec3d vec3d = state.getModelOffset(pos);
return SHAPE.offset(vec3d.x, vec3d.y, vec3d.z);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.minecraft.block.SaplingBlock;
import net.minecraft.data.server.loottable.vanilla.VanillaBlockLootTableGenerator;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.loot.condition.TableBonusLootCondition;
Expand All @@ -25,14 +24,14 @@ protected TerrestriaBlockLootTableProvider(FabricDataOutput output, CompletableF

@Override
public void generate() {
RegistryWrapper.Impl<Enchantment> enchantmentRegistry = this.registryLookup.getWrapperOrThrow(RegistryKeys.ENCHANTMENT);
RegistryWrapper.Impl<Enchantment> enchantmentRegistry = this.registries.getOrThrow(RegistryKeys.ENCHANTMENT);

// simple blocks
addDrop(TerrestriaBlocks.AGAVE);
addDrop(TerrestriaBlocks.ALOE_VERA);
addDrop(TerrestriaBlocks.BLACK_SAND);
addDrop(TerrestriaBlocks.BRYCE_SAPLING);
addDrop(TerrestriaBlocks.CATTAIL, VanillaBlockLootTableGenerator::dropsWithShears);
addDrop(TerrestriaBlocks.CATTAIL, this::dropsWithShears);
addDrop(TerrestriaBlocks.CYPRESS_SAPLING);
addDrop(TerrestriaBlocks.DARK_JAPANESE_MAPLE_SAPLING);
addDrop(TerrestriaBlocks.DEAD_GRASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private void addWood(TagKey<Block> logTag, WoodBlocks woodBlock) {
woodBuilder
.add(woodBlock.wood)
.add(woodBlock.strippedWood);
getOrCreateTagBuilder(TerrestriaBlockTags.STRIPPED_WOOD).add(woodBlock.strippedWood);
getOrCreateTagBuilder(TerrestriaBlockTags.STRIPPED_WOODS).add(woodBlock.strippedWood);
}

if (woodBlock.hasQuarterLog()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public static void buildRegistry(RegistryBuilder registryBuilder) {

@Override
public void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
addAll(entries, registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE), Terrestria.MOD_ID);
addAll(entries, registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE), Terrestria.MOD_ID);
addAll(entries, registries.getWrapperOrThrow(RegistryKeys.BIOME), Terrestria.MOD_ID);
addAll(entries, registries.getOrThrow(RegistryKeys.CONFIGURED_FEATURE), Terrestria.MOD_ID);
addAll(entries, registries.getOrThrow(RegistryKeys.PLACED_FEATURE), Terrestria.MOD_ID);
addAll(entries, registries.getOrThrow(RegistryKeys.BIOME), Terrestria.MOD_ID);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void configure(RegistryWrapper.WrapperLookup registries) {

copy(TerrestriaBlockTags.STRIPPED_LOGS, TerrestriaItemTags.STRIPPED_LOGS);

copy(TerrestriaBlockTags.STRIPPED_WOOD, TerrestriaItemTags.STRIPPED_WOOD);
copy(TerrestriaBlockTags.STRIPPED_WOODS, TerrestriaItemTags.STRIPPED_WOODS);


// dirt type tags
Expand Down
Loading

0 comments on commit bb276bb

Please sign in to comment.