Skip to content

Commit

Permalink
Remove redundant locateany, fix leaves suffocating, fix certain leave…
Browse files Browse the repository at this point in the history
…s not have hoe as a tool, added andisol grass path item, fix sheep not eating andisol grass, fix trees growing on sand setting dirt below, give small oak logs the oak logs tag for recipes and stuff, fix lang for potted yucca palm sapling #change "Leaves no longer suffocate entities" #change "Fixed certain leaves not easily broken by a hoe" #change "Fixed Andisol Grass Path not having an item" #change "Fixed Andisol Grass Blocks not being eaten by sheep" #change "Fixed sandy trees having dirt below them" #change "Fixed Andisol Grass Blocks spreading improperly" #change "Fixed small oak logs not having oak log recipes" #change "Fixed localization for Potted Yucca Palm Saplings" (#173)
  • Loading branch information
Prospector authored Aug 16, 2020
1 parent 91a13fe commit 5a26b64
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 100 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.jvmargs=-Xmx1G

mod_version=2.0.4
mod_version=2.0.5
maven_group=com.terraformersmc
archive_name=terrestria

minecraft_version=1.16.1
yarn_mappings=1.16.1+build.4
loader_version=0.8.8+build.202
fabric_version=0.13.1+build.370-1.16
terraform_version=2.1.7+build.31
terraform_version=2.3.0+build.33
shapes_version=2.0.0+build.10
libstructure_version=1.3

Expand Down
4 changes: 1 addition & 3 deletions src/main/java/com/terraformersmc/terrestria/Terrestria.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.terraformersmc.terraform.config.BiomeConfig;
import com.terraformersmc.terraform.config.BiomeConfigHandler;
import com.terraformersmc.terrestria.command.LocateAny;
import com.terraformersmc.terrestria.config.TerrestriaConfigManager;
import com.terraformersmc.terrestria.init.*;
import com.terraformersmc.terrestria.item.LogTurnerItem;
Expand All @@ -23,7 +22,7 @@ public class Terrestria implements ModInitializer {
public static final String MOD_ID = "terrestria";
public static ItemGroup itemGroup;
public static BiomeConfigHandler biomeConfigHandler;
public static final Logger log = LogManager.getLogger(MOD_ID);
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);

@Override
public void onInitialize() {
Expand Down Expand Up @@ -53,6 +52,5 @@ public void onInitialize() {
biomeConfigHandler.save();

Registry.register(Registry.ITEM, new Identifier(MOD_ID, "log_turner"), new LogTurnerItem(new Item.Settings().group(itemGroup)));
LocateAny.register();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void onInitializeClient() {

ColorProviderRegistry.ITEM.register(
GRASS_ITEM_COLORS,
TerrestriaItems.BASALT_GRASS_BLOCK
TerrestriaItems.ANDISOL_GRASS_BLOCK
);

addBoatRenderer(TerrestriaEntities.REDWOOD_BOAT);
Expand Down
50 changes: 0 additions & 50 deletions src/main/java/com/terraformersmc/terrestria/command/LocateAny.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,16 @@
import com.terraformersmc.terrestria.init.helpers.WoodBlocks;
import com.terraformersmc.terrestria.init.helpers.WoodColors;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.FlowerPotBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.PlantBlock;
import net.minecraft.block.SandBlock;
import net.minecraft.block.SeagrassBlock;
import net.minecraft.block.TallSeagrassBlock;
import net.minecraft.block.*;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.sound.BlockSoundGroup;

import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockView;

// This class exports public block constants, these fields have to be public
@SuppressWarnings("WeakerAccess")
Expand Down Expand Up @@ -139,15 +132,15 @@ public static void init() {
flammable.add(SMALL_OAK_LOG, 5, 5);
flammable.add(STRIPPED_SMALL_OAK_LOG, 5, 5);

JAPANESE_MAPLE_SHRUB_LEAVES = TerrestriaRegistry.register("japanese_maple_shrub_leaves", new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)));
JAPANESE_MAPLE_SHRUB_LEAVES = TerrestriaRegistry.register("japanese_maple_shrub_leaves", new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).allowsSpawning(TerrestriaBlocks::canSpawnOnLeaves).suffocates(TerrestriaBlocks::never).blockVision(TerrestriaBlocks::never)));

DARK_JAPANESE_MAPLE_LEAVES = TerrestriaRegistry.register("dark_japanese_maple_leaves",
new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).materialColor(MaterialColor.RED_TERRACOTTA))
new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(MaterialColor.RED_TERRACOTTA).allowsSpawning(TerrestriaBlocks::canSpawnOnLeaves).suffocates(TerrestriaBlocks::never).blockVision(TerrestriaBlocks::never))
);

JUNGLE_PALM_LEAVES = TerrestriaRegistry.register("jungle_palm_leaves", new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)));
JUNGLE_PALM_LEAVES = TerrestriaRegistry.register("jungle_palm_leaves", new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).allowsSpawning(TerrestriaBlocks::canSpawnOnLeaves).suffocates(TerrestriaBlocks::never).blockVision(TerrestriaBlocks::never)));

SAKURA_LEAF_PILE = TerrestriaRegistry.register("sakura_leaf_pile", new LeafPileBlock(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).strength(0.025f, 0.1f).noCollision().sounds(BlockSoundGroup.GRASS).materialColor(MaterialColor.FOLIAGE)));
SAKURA_LEAF_PILE = TerrestriaRegistry.register("sakura_leaf_pile", new LeafPileBlock(FabricBlockSettings.of(Material.REPLACEABLE_PLANT).strength(0.025f, 0.1f).noCollision().sounds(BlockSoundGroup.GRASS).materialColor(MaterialColor.FOLIAGE).breakByTool(FabricToolTags.HOES)));

flammable.add(JAPANESE_MAPLE_SHRUB_LEAVES, 30, 60);
flammable.add(DARK_JAPANESE_MAPLE_LEAVES, 30, 60);
Expand Down Expand Up @@ -218,4 +211,11 @@ public static void init() {
POTTED_AGAVE = TerrestriaRegistry.register("potted_agave", new FlowerPotBlock(AGAVE, FabricBlockSettings.copyOf(Blocks.POTTED_POPPY)));
POTTED_ALOE_VERA = TerrestriaRegistry.register("potted_aloe_vera", new FlowerPotBlock(ALOE_VERA, FabricBlockSettings.copyOf(Blocks.POTTED_POPPY)));
}

public static boolean never(BlockState state, BlockView world, BlockPos pos) {
return false;
}
public static Boolean canSpawnOnLeaves(BlockState state, BlockView world, BlockPos pos, EntityType<?> type) {
return type == EntityType.OCELOT || type == EntityType.PARROT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ public class TerrestriaItems {
public static BlockItem SAGUARO_CACTUS_SAPLING;
public static BlockItem YUCCA_PALM_SAPLING;

public static StoneItems BASALT;
public static BlockItem BASALT_SAND;
public static BlockItem BASALT_DIRT;
public static BlockItem BASALT_GRASS_BLOCK;
public static BlockItem BASALT_PODZOL;
public static StoneItems VOLCANIC_ROCK;
public static BlockItem BLACK_SAND;
public static BlockItem ANDISOL;
public static BlockItem ANDISOL_GRASS_BLOCK;
public static BlockItem ANDISOL_GRASS_PATH;
public static BlockItem ANDISOL_PODZOL;
public static BlockItem ANDISOL_FARMLAND;
public static BlockItem INDIAN_PAINTBRUSH;
public static BlockItem MONSTERAS;
Expand Down Expand Up @@ -115,11 +116,12 @@ public static void init() {
SAGUARO_CACTUS_SAPLING = TerrestriaRegistry.registerBlockItem("saguaro_cactus_sapling", TerrestriaBlocks.SAGUARO_CACTUS_SAPLING);
YUCCA_PALM_SAPLING = TerrestriaRegistry.registerBlockItem("yucca_palm_sapling", TerrestriaBlocks.YUCCA_PALM_SAPLING);

BASALT = StoneItems.register("basalt", TerrestriaBlocks.VOLCANIC_ROCK);
BASALT_SAND = TerrestriaRegistry.registerBlockItem("basalt_sand", TerrestriaBlocks.BLACK_SAND);
BASALT_DIRT = TerrestriaRegistry.registerBlockItem("basalt_dirt", TerrestriaBlocks.ANDISOL);
BASALT_GRASS_BLOCK = TerrestriaRegistry.registerBlockItem("basalt_grass_block", TerrestriaBlocks.ANDISOL_GRASS_BLOCK);
BASALT_PODZOL = TerrestriaRegistry.registerBlockItem("basalt_podzol", TerrestriaBlocks.ANDISOL_PODZOL);
VOLCANIC_ROCK = StoneItems.register("basalt", TerrestriaBlocks.VOLCANIC_ROCK);
BLACK_SAND = TerrestriaRegistry.registerBlockItem("basalt_sand", TerrestriaBlocks.BLACK_SAND);
ANDISOL = TerrestriaRegistry.registerBlockItem("basalt_dirt", TerrestriaBlocks.ANDISOL);
ANDISOL_GRASS_BLOCK = TerrestriaRegistry.registerBlockItem("basalt_grass_block", TerrestriaBlocks.ANDISOL_GRASS_BLOCK);
ANDISOL_GRASS_PATH = TerrestriaRegistry.registerBlockItem("andisol_grass_path", TerrestriaBlocks.ANDISOL_GRASS_PATH);
ANDISOL_PODZOL = TerrestriaRegistry.registerBlockItem("basalt_podzol", TerrestriaBlocks.ANDISOL_PODZOL);
ANDISOL_FARMLAND = TerrestriaRegistry.registerBlockItem("andisol_farmland", TerrestriaBlocks.ANDISOL_FARMLAND);
INDIAN_PAINTBRUSH = TerrestriaRegistry.registerBlockItem("indian_paintbrush", TerrestriaBlocks.INDIAN_PAINTBRUSH);
MONSTERAS = TerrestriaRegistry.registerBlockItem("monsteras", TerrestriaBlocks.MONSTERAS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.terraformersmc.terraform.block.*;
import com.terraformersmc.terrestria.Terrestria;
import com.terraformersmc.terrestria.block.TerrestriaOptiLeavesBlock;
import com.terraformersmc.terrestria.init.TerrestriaBlocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import net.fabricmc.fabric.api.registry.FuelRegistry;
Expand Down Expand Up @@ -39,12 +40,12 @@ protected static WoodBlocks register(String name, WoodColors colors, FlammableBl
if (size.equals(LogSize.SMALL)) {
throw new IllegalArgumentException("Small log trees are not compatible with extended leaves, I'm not sure how you even did this...");
}
blocks.leaves = TerrestriaRegistry.register(name + "_leaves", new TerrestriaOptiLeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(colors.leaves)));
blocks.leaves = TerrestriaRegistry.register(name + "_leaves", new TerrestriaOptiLeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(colors.leaves).allowsSpawning(TerrestriaBlocks::canSpawnOnLeaves).suffocates(TerrestriaBlocks::never).blockVision(TerrestriaBlocks::never)));
} else {
if (size.equals(LogSize.SMALL)) {
blocks.leaves = TerrestriaRegistry.register(name + "_leaves", new TransparentLeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(colors.leaves)));
blocks.leaves = TerrestriaRegistry.register(name + "_leaves", new TransparentLeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(colors.leaves).allowsSpawning(TerrestriaBlocks::canSpawnOnLeaves).suffocates(TerrestriaBlocks::never).blockVision(TerrestriaBlocks::never)));
} else {
blocks.leaves = TerrestriaRegistry.register(name + "_leaves", new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(colors.leaves)));
blocks.leaves = TerrestriaRegistry.register(name + "_leaves", new LeavesBlock(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES).breakByTool(FabricToolTags.HOES).materialColor(colors.leaves).allowsSpawning(TerrestriaBlocks::canSpawnOnLeaves).suffocates(TerrestriaBlocks::never).blockVision(TerrestriaBlocks::never)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,25 @@ public class MixinEatGrassGoal {
@Final
private World world;

@Shadow
private int timer;

@Inject(method = "canStart", at = @At(value = "FIELD", target = "Lnet/minecraft/block/Blocks;GRASS_BLOCK:Lnet/minecraft/block/Block;"), cancellable = true)
private void canStart(CallbackInfoReturnable<Boolean> callbackInfo) {
BlockPos pos = this.mob.getPositionTarget();

if(this.world.getBlockState(pos.down()).getBlock() == TerrestriaBlocks.ANDISOL_GRASS_BLOCK) {
if (this.world.getBlockState(pos.down()).getBlock() == TerrestriaBlocks.ANDISOL_GRASS_BLOCK) {
callbackInfo.setReturnValue(true);
}
}

@Inject(method = "tick", at = @At("HEAD"))
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/BlockPos;down()Lnet/minecraft/util/math/BlockPos;"))
private void tick(CallbackInfo info) {
if (this.timer - 1 == 4) {
BlockPos pos = this.mob.getPositionTarget();
BlockPos downPos = pos.down();

if (this.world.getBlockState(downPos).getBlock() == TerrestriaBlocks.ANDISOL_GRASS_BLOCK) {
if (this.world.getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING)) {
this.world.syncGlobalEvent(2001, downPos, Block.getRawIdFromState(Blocks.GRASS_BLOCK.getDefaultState()));
this.world.setBlockState(downPos, TerrestriaBlocks.ANDISOL.getDefaultState(), 2);
}

this.mob.onEatingGrass();
BlockPos pos = this.mob.getBlockPos().down();
if (this.world.getBlockState(pos).isOf(TerrestriaBlocks.ANDISOL_GRASS_BLOCK)) {
if (this.world.getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING)) {
this.world.syncWorldEvent(2001, pos, Block.getRawIdFromState(Blocks.GRASS_BLOCK.getDefaultState()));
this.world.setBlockState(pos, TerrestriaBlocks.ANDISOL.getDefaultState(), 2);
}

this.mob.onEatingGrass();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.terraformersmc.terrestria.mixin;

import com.terraformersmc.terrestria.init.TerrestriaBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ModifiableTestableWorld;
import net.minecraft.world.gen.feature.TreeFeature;
import net.minecraft.world.gen.trunk.TrunkPlacer;
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(TrunkPlacer.class)
public class MixinTrunkPlacer {
@Inject(method = "method_27400", at = @At("HEAD"), cancellable = true)
private static void notAlwaysDirt(ModifiableTestableWorld world, BlockPos pos, CallbackInfo ci) {
if (world.testBlockState(pos, (blockState) -> {
Block block = blockState.getBlock();
return block == Blocks.SAND || block == Blocks.RED_SAND || block == TerrestriaBlocks.BLACK_SAND;
})) {
ci.cancel();
} else if (world.testBlockState(pos, (blockState) -> {
Block block = blockState.getBlock();
return block == TerrestriaBlocks.ANDISOL || block == TerrestriaBlocks.ANDISOL_GRASS_BLOCK || block == TerrestriaBlocks.ANDISOL_PODZOL;
})) {
TreeFeature.setBlockStateWithoutUpdatingNeighbors(world, pos, TerrestriaBlocks.ANDISOL.getDefaultState());
ci.cancel();
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/terrestria/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"block.terrestria.potted_jungle_palm_sapling": "Potted Jungle Palm Sapling",
"block.terrestria.potted_japanese_maple_shrub_sapling": "Potted Japanese Maple Shrub Sapling",
"block.terrestria.potted_saguaro_cactus_sapling": "Potted Saguaro Cactus Sapling",
"block.terrestria.potted_yucca_palm_sapling": "Potted Yucca Palm Sapling",
"block.terrestria.agave": "Agave",
"block.terrestria.tiny_cactus": "Tiny Cactus",
"block.terrestria.aloe_vera": "Aloe Vera",
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/data/minecraft/tags/blocks/oak_logs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"minecraft:oak_log",
"minecraft:oak_wood",
"minecraft:stripped_oak_log",
"minecraft:stripped_oak_wood",
"#terrestria:small_oak_logs"
]
}
10 changes: 10 additions & 0 deletions src/main/resources/data/minecraft/tags/items/oak_logs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"minecraft:oak_log",
"minecraft:oak_wood",
"minecraft:stripped_oak_log",
"minecraft:stripped_oak_wood",
"#terrestria:small_oak_logs"
]
}
1 change: 1 addition & 0 deletions src/main/resources/mixins.terrestria.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"MixinPlantBlock",
"MixinSugarCaneBlock",
"MixinTreeFeature",
"MixinTrunkPlacer",
"TreeDecoratorTypeAccessor"
],
"injectors": {
Expand Down

0 comments on commit 5a26b64

Please sign in to comment.