Deforester works on slime saplings

This commit is contained in:
grimmauld 2020-10-16 11:14:47 +02:00
parent db2b8dd197
commit c9e2f8b05e
7 changed files with 179 additions and 131 deletions

View file

@ -79,7 +79,7 @@ sourceSets.main.resources {
repositories {
maven {
// location of the maven that hosts JEI files
// location of the maven that hosts JEI files (And TiC)
name "Progwml6 maven"
url "https://dvs1.progwml6.com/files/maven/"
}
@ -120,6 +120,8 @@ dependencies {
// i'll leave this here commented for easier testing
//runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69")
//runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984")
runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.3-1.6.40")
runtimeOnly fg.deobf("slimeknights.tconstruct:TConstruct:1.16.3-3.0.1.24")
}
jar {

View file

@ -60,10 +60,10 @@
},
{
"when": {
"up": "true",
"down": "false",
"south": "false",
"north": "true"
"north": "true",
"up": "true",
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lu_x"
@ -71,10 +71,10 @@
},
{
"when": {
"up": "true",
"down": "false",
"south": "true",
"north": "false"
"north": "false",
"up": "true",
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ru_x"
@ -82,10 +82,10 @@
},
{
"when": {
"up": "false",
"down": "true",
"south": "false",
"north": "true"
"north": "true",
"up": "false",
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ld_x"
@ -93,10 +93,10 @@
},
{
"when": {
"up": "false",
"down": "true",
"south": "true",
"north": "false"
"north": "false",
"up": "false",
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/rd_x"
@ -104,21 +104,21 @@
},
{
"when": {
"up": "true",
"down": "true",
"south": "false",
"north": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_x"
}
},
{
"when": {
"north": "false",
"up": "true",
"down": "false",
"south": "false",
"north": "false"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_x"
}
},
{
"when": {
"down": "false",
"north": "false",
"up": "true",
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_x"
@ -126,10 +126,10 @@
},
{
"when": {
"up": "false",
"down": "true",
"south": "false",
"north": "false"
"north": "false",
"up": "false",
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_x"
@ -137,10 +137,10 @@
},
{
"when": {
"up": "false",
"down": "false",
"south": "true",
"north": "true"
"north": "true",
"up": "false",
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/lr_x"
@ -148,10 +148,10 @@
},
{
"when": {
"up": "false",
"down": "false",
"south": "false",
"north": "true"
"north": "true",
"up": "false",
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_x"
@ -159,10 +159,10 @@
},
{
"when": {
"up": "false",
"down": "false",
"south": "true",
"north": "false"
"north": "false",
"up": "false",
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/lr_x"
@ -170,10 +170,10 @@
},
{
"when": {
"up": "false",
"down": "false",
"south": "false",
"north": "false"
"north": "false",
"up": "false",
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/none_x"
@ -182,9 +182,9 @@
{
"when": {
"west": "true",
"south": "true",
"east": "false",
"north": "false",
"east": "false"
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/lu_y"
@ -193,9 +193,9 @@
{
"when": {
"west": "false",
"south": "true",
"east": "true",
"north": "false",
"east": "true"
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ru_y"
@ -204,9 +204,9 @@
{
"when": {
"west": "true",
"south": "false",
"east": "false",
"north": "true",
"east": "false"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ld_y"
@ -215,9 +215,9 @@
{
"when": {
"west": "false",
"south": "false",
"east": "true",
"north": "true",
"east": "true"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/rd_y"
@ -226,9 +226,9 @@
{
"when": {
"west": "false",
"south": "true",
"east": "false",
"north": "true",
"east": "false"
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ud_y"
@ -237,9 +237,9 @@
{
"when": {
"west": "false",
"south": "true",
"east": "false",
"north": "false",
"east": "false"
"south": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ud_y"
@ -248,9 +248,9 @@
{
"when": {
"west": "false",
"south": "false",
"east": "false",
"north": "true",
"east": "false"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_y"
@ -259,9 +259,9 @@
{
"when": {
"west": "true",
"south": "false",
"east": "true",
"north": "false",
"east": "true"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_y"
@ -270,9 +270,9 @@
{
"when": {
"west": "true",
"south": "false",
"east": "false",
"north": "false",
"east": "false"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_y"
@ -281,9 +281,9 @@
{
"when": {
"west": "false",
"south": "false",
"east": "true",
"north": "false",
"east": "true"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_y"
@ -292,9 +292,9 @@
{
"when": {
"west": "false",
"south": "false",
"east": "false",
"north": "false",
"east": "false"
"south": "false"
},
"apply": {
"model": "create:block/fluid_pipe/none_y"
@ -302,10 +302,10 @@
},
{
"when": {
"up": "true",
"west": "false",
"down": "false",
"east": "true"
"east": "true",
"up": "true"
},
"apply": {
"model": "create:block/fluid_pipe/lu_z"
@ -313,10 +313,10 @@
},
{
"when": {
"up": "true",
"west": "true",
"down": "false",
"east": "false"
"east": "false",
"up": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ru_z"
@ -324,10 +324,10 @@
},
{
"when": {
"up": "false",
"west": "false",
"down": "true",
"east": "true"
"east": "true",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ld_z"
@ -335,10 +335,10 @@
},
{
"when": {
"up": "false",
"west": "true",
"down": "true",
"east": "false"
"east": "false",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/rd_z"
@ -346,10 +346,10 @@
},
{
"when": {
"up": "true",
"west": "false",
"down": "true",
"east": "false"
"east": "false",
"up": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ud_z"
@ -357,10 +357,10 @@
},
{
"when": {
"up": "true",
"west": "false",
"down": "false",
"east": "false"
"east": "false",
"up": "true"
},
"apply": {
"model": "create:block/fluid_pipe/ud_z"
@ -368,10 +368,10 @@
},
{
"when": {
"up": "false",
"west": "false",
"down": "true",
"east": "false"
"east": "false",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/ud_z"
@ -379,10 +379,10 @@
},
{
"when": {
"up": "false",
"west": "true",
"down": "false",
"east": "true"
"east": "true",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_z"
@ -390,10 +390,10 @@
},
{
"when": {
"up": "false",
"west": "false",
"down": "false",
"east": "true"
"east": "true",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_z"
@ -401,10 +401,10 @@
},
{
"when": {
"up": "false",
"west": "true",
"down": "false",
"east": "false"
"east": "false",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/lr_z"
@ -412,10 +412,10 @@
},
{
"when": {
"up": "false",
"west": "false",
"down": "false",
"east": "false"
"east": "false",
"up": "false"
},
"apply": {
"model": "create:block/fluid_pipe/none_z"

View file

@ -29,8 +29,8 @@
},
{
"when": {
"axis": "x",
"sticky_south": "true"
"sticky_south": "true",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky",
@ -39,8 +39,8 @@
},
{
"when": {
"axis": "y",
"sticky_south": "true"
"sticky_south": "true",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y_sticky"
@ -48,8 +48,8 @@
},
{
"when": {
"axis": "z",
"sticky_south": "true"
"sticky_south": "true",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky",
@ -59,8 +59,8 @@
},
{
"when": {
"axis": "x",
"sticky_south": "false"
"sticky_south": "false",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x",
@ -69,8 +69,8 @@
},
{
"when": {
"axis": "y",
"sticky_south": "false"
"sticky_south": "false",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y"
@ -78,8 +78,8 @@
},
{
"when": {
"axis": "z",
"sticky_south": "false"
"sticky_south": "false",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_x",
@ -89,8 +89,8 @@
},
{
"when": {
"axis": "x",
"sticky_west": "true"
"sticky_west": "true",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky",
@ -99,8 +99,8 @@
},
{
"when": {
"axis": "y",
"sticky_west": "true"
"sticky_west": "true",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y_sticky",
@ -109,8 +109,8 @@
},
{
"when": {
"axis": "z",
"sticky_west": "true"
"sticky_west": "true",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_z_sticky",
@ -119,8 +119,8 @@
},
{
"when": {
"axis": "x",
"sticky_west": "false"
"sticky_west": "false",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x",
@ -129,8 +129,8 @@
},
{
"when": {
"axis": "y",
"sticky_west": "false"
"sticky_west": "false",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y",
@ -139,8 +139,8 @@
},
{
"when": {
"axis": "z",
"sticky_west": "false"
"sticky_west": "false",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_z",
@ -149,8 +149,8 @@
},
{
"when": {
"axis": "x",
"sticky_north": "true"
"sticky_north": "true",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky"
@ -158,8 +158,8 @@
},
{
"when": {
"axis": "y",
"sticky_north": "true"
"sticky_north": "true",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y_sticky",
@ -168,8 +168,8 @@
},
{
"when": {
"axis": "z",
"sticky_north": "true"
"sticky_north": "true",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_x_sticky",
@ -178,8 +178,8 @@
},
{
"when": {
"axis": "x",
"sticky_north": "false"
"sticky_north": "false",
"axis": "x"
},
"apply": {
"model": "create:block/radial_chassis_side_x"
@ -187,8 +187,8 @@
},
{
"when": {
"axis": "y",
"sticky_north": "false"
"sticky_north": "false",
"axis": "y"
},
"apply": {
"model": "create:block/radial_chassis_side_y",
@ -197,8 +197,8 @@
},
{
"when": {
"axis": "z",
"sticky_north": "false"
"sticky_north": "false",
"axis": "z"
},
"apply": {
"model": "create:block/radial_chassis_side_x",

View file

@ -1,11 +1,9 @@
package com.simibubi.create;
import static com.simibubi.create.AllTags.NameSpace.FORGE;
import static com.simibubi.create.AllTags.NameSpace.MOD;
import java.util.function.Function;
import com.simibubi.create.foundation.data.CreateRegistrate;
import com.simibubi.create.foundation.utility.EmptyNamedTag;
import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.builders.BlockBuilder;
import com.tterrag.registrate.builders.ItemBuilder;
@ -23,6 +21,9 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.ModList;
import static com.simibubi.create.AllTags.NameSpace.*;
public class AllTags {
private static final CreateRegistrate REGISTRATE = Create.registrate()
@ -53,7 +54,7 @@ public class AllTags {
public static enum NameSpace {
MOD(Create.ID), FORGE("forge"), MC("minecraft")
MOD(Create.ID), FORGE("forge"), MC("minecraft"), TIC("tconstruct")
;
String id;
@ -105,7 +106,7 @@ public class AllTags {
}
public static enum AllBlockTags {
WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, NON_MOVABLE, BRITTLE, SEATS, VALVE_HANDLES, FAN_TRANSPARENT
WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, NON_MOVABLE, BRITTLE, SEATS, VALVE_HANDLES, FAN_TRANSPARENT, SLIMY_LOGS(TIC)
;
@ -120,9 +121,13 @@ public class AllTags {
}
private AllBlockTags(NameSpace namespace, String path) {
tag = BlockTags.makeWrapperTag(
new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())).toString());
ResourceLocation id = new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name()));
if (ModList.get().isLoaded(namespace.id)) {
tag = BlockTags.makeWrapperTag(id.toString());
REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag));
} else {
tag = new EmptyNamedTag<>(id);
}
}
public boolean matches(BlockState block) {

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.curiosities.tools;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTags;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.TreeCutter;
import com.simibubi.create.foundation.utility.TreeCutter.Tree;
@ -32,7 +33,7 @@ public class DeforesterItem extends AxeItem {
// Moved away from Item#onBlockDestroyed as it does not get called in Creative
public static void destroyTree(ItemStack stack, IWorld iWorld, BlockState state, BlockPos pos,
PlayerEntity player) {
if (!state.isIn(BlockTags.LOGS) || player.isSneaking() || !(iWorld instanceof World))
if (!(state.isIn(BlockTags.LOGS) || AllTags.AllBlockTags.SLIMY_LOGS.matches(state)) || player.isSneaking() || !(iWorld instanceof World))
return;
World worldIn = (World) iWorld;
Tree tree = TreeCutter.cutTree(worldIn, pos);

View file

@ -0,0 +1,39 @@
package com.simibubi.create.foundation.utility;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.Collections;
import java.util.List;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class EmptyNamedTag<T> implements Tags.IOptionalNamedTag<T> {
private final ResourceLocation id;
public EmptyNamedTag(ResourceLocation id) {
this.id = id;
}
@Override
public boolean isDefaulted() {
return false;
}
@Override
public ResourceLocation getId() {
return id;
}
@Override
public boolean contains(Object p_230235_1_) {
return false;
}
@Override
public List<T> values() {
return Collections.emptyList() ;
}
}

View file

@ -9,6 +9,7 @@ import java.util.Set;
import com.google.common.base.Predicates;
import com.simibubi.create.AllTags;
import net.minecraft.block.BambooBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -204,7 +205,7 @@ public class TreeCutter {
}
private static boolean isLog(BlockState state) {
return state.isIn(BlockTags.LOGS);
return state.isIn(BlockTags.LOGS) || AllTags.AllBlockTags.SLIMY_LOGS.matches(state);
}
private static boolean isLeaf(BlockState state) {