Skip to content

Commit

Permalink
Correct Hitboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
lilypuree committed Jun 28, 2020
1 parent 829242b commit 0a099a0
Show file tree
Hide file tree
Showing 229 changed files with 689 additions and 259 deletions.
70 changes: 49 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,58 @@ buildscript {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
maven {url='https://dist.creeper.host/Sponge/maven'}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '0.0.1'
group = 'lilypuree.forest_tree' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'forest_tree'
version = "${mod_version}"
group = "lilypuree.${modid}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "${modid}"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20200308-1.15.1'
mappings channel: 'snapshot', version: "${mapping}-1.15.1"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
runs {
client {
workingDirectory project.file('run')
arg "-mixin.config="+archivesBaseName+".mixins.json"

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
forest_tree {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')
arg "-mixin.config="+archivesBaseName+".mixins.json"

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
forest_tree {
source sourceSets.main
}
}
Expand All @@ -69,32 +64,57 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

args '--mod', 'forest_tree', '--all', '--output', file('src/generated/resources/')

mods {
examplemod {
forest_tree {
source sourceSets.main
}
}
}
}
}

repositories{
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}

maven {url='https://dist.creeper.host/Sponge/maven'}

jcenter()
mavenCentral()

}

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.15.2-31.1.19'
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
// compile "some.group:artifact:version"

compile 'org.spongepowered:mixin:0.8'

// compile against the JEI API but do not include it at runtime
compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}")

// Real examples
// compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
Expand All @@ -115,13 +135,15 @@ dependencies {
jar {
manifest {
attributes([
"Specification-Title": "examplemod",
"Specification-Title": "${modid}",
"Specification-Vendor": "examplemodsareus",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"examplemodsareus",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "${modid}.mixins.json",
"MixinConnector": "lilypuree.${modid}.mixin.Connector"
])
}
}
Expand All @@ -146,4 +168,10 @@ publishing {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}

apply plugin: 'org.spongepowered.mixin'

mixin {
add sourceSets.main, "${modid}.refmap.json"
}
10 changes: 8 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx3G -Dmixin.debug=true
org.gradle.daemon=false
mod_version=1.0
modid=forest_tree
mc_version=1.15.2
forge_version=31.1.19
mapping=20200624
jei_version = 6.0.0.3
4 changes: 1 addition & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ if [ -n "$JAVA_HOME" ] ; then
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
Expand Down Expand Up @@ -169,4 +167,4 @@ if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
43 changes: 39 additions & 4 deletions src/main/java/lilypuree/forest_tree/Registration.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.merchant.villager.VillagerProfession;
import net.minecraft.item.BlockItem;
Expand All @@ -26,6 +28,8 @@
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;

import java.util.function.Consumer;

import static lilypuree.forest_tree.ForestTree.MODID;

public class Registration {
Expand All @@ -51,13 +55,43 @@ public static void register() {
public static final RegistryObject<AdvancedSaplingBlock> OAK_SAPLING = BLOCKS.register("oak_sapling", ()->new AdvancedSaplingBlock(new AdvancedOakTree(), Block.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().hardnessAndResistance(0f).sound(SoundType.PLANT)));
public static final RegistryObject<AdvancedSaplingBlock> PINE_SAPLING = BLOCKS.register("fir_sapling", ()->new AdvancedSaplingBlock(new PineTree(), Block.Properties.create(Material.PLANTS).doesNotBlockMovement().tickRandomly().hardnessAndResistance(0f).sound(SoundType.PLANT)));

public static final ImmutableMap<Pair<Integer, Vec3i>, RegistryObject<Block>> BRANCH_BLOCKS;
public static final ImmutableMap<Pair<Integer, Vec3i>, RegistryObject<Block>> BRANCH_END_BLOCKS;
public static final ImmutableMap<Pair<Integer, Vec3i>, RegistryObject<BranchBlock>> BRANCH_BLOCKS;
public static final ImmutableMap<Pair<Integer, Vec3i>, RegistryObject<BranchBlock>> BRANCH_END_BLOCKS;
public static final ImmutableMap<Integer, RegistryObject<Item>> BRANCH_BLOCK_ITEMS;

public static void forAllBranches(Consumer<BranchBlock> action){
for (Species species : ModSpecies.allSpecies()) {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
if (x == 0 && y == 0 && z == 0) continue;
Vec3i sourceDir = new Vec3i(x, y, z);
Pair<Integer, Vec3i> pair = ImmutablePair.of(species.getID(), sourceDir);
action.accept(BRANCH_BLOCKS.get(pair).get());
}
}
}
}
}

public static void forAllBranchEnds(Consumer<BranchBlock> action){
for (Species species : ModSpecies.allSpecies()) {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
if (x == 0 && y == 0 && z == 0) continue;
Vec3i sourceDir = new Vec3i(x, y, z);
Pair<Integer, Vec3i> pair = ImmutablePair.of(species.getID(), sourceDir);
action.accept(BRANCH_END_BLOCKS.get(pair).get());
}
}
}
}
}

static {
ImmutableMap.Builder<Pair<Integer, Vec3i>, RegistryObject<Block>> branchBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Pair<Integer, Vec3i>, RegistryObject<Block>> branchEndBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Pair<Integer, Vec3i>, RegistryObject<BranchBlock>> branchBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Pair<Integer, Vec3i>, RegistryObject<BranchBlock>> branchEndBuilder = ImmutableMap.builder();
ImmutableMap.Builder<Integer, RegistryObject<Item>> itemBuilder = ImmutableMap.builder();

Block.Properties properties = Block.Properties.create(Material.WOOD).hardnessAndResistance(2.0f).sound(SoundType.WOOD).notSolid();
Expand All @@ -68,6 +102,7 @@ public static void register() {
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
for (int z = -1; z <= 1; z++) {
if(x==0 && y==0 && z==0)continue;
String name = species.getName() + "_branch_" + x + "_" + y + "_" + z;
String endName = species.getName() + "_branch_end_" + x + "_" + y + "_" + z;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import lilypuree.forest_tree.ForestTree;
import lilypuree.forest_tree.trees.world.biome.ForestTreeFeatureConfigs;
import lilypuree.forest_tree.trees.world.gen.feature.AdvancedTreeFeatureConfig;
import lilypuree.forest_tree.trees.world.gen.feature.CustomShortTreeFeature;
import lilypuree.forest_tree.trees.world.gen.feature.DouglasFirTreeFeature;
import lilypuree.forest_tree.trees.world.gen.feature.PineTreeFeature;
import lilypuree.forest_tree.trees.world.gen_old.feature.*;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.TreeFeatureConfig;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -17,7 +13,8 @@ public class ForestTreeFeatures {

// public static final Feature<TreeFeatureConfig> ROSEWOOD_TREE = new RosewoodTreeFeature(TreeFeatureConfig::func_227338_a_, false);
public static final Feature<AdvancedTreeFeatureConfig> DEFAULT_TREE = new CustomShortTreeFeature((ops)-> ForestTreeFeatureConfigs.OAK_TREE_CONFIG);
public static final Feature<AdvancedTreeFeatureConfig> PINE = new PineTreeFeature((ops)-> ForestTreeFeatureConfigs.PINE_CONFIG);
public static final Feature<AdvancedTreeFeatureConfig> PINE = new CedarTreeFeature((ops)-> ForestTreeFeatureConfigs.PINE_CONFIG);



@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package lilypuree.forest_tree.core.setup;


import lilypuree.forest_tree.ForestTree;
import lilypuree.forest_tree.trees.block.BranchBlock;
import lilypuree.forest_tree.trees.block.BranchVoxelShapes;
import lilypuree.forest_tree.util.Util;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.*;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(modid = ForestTree.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.FORGE)
public class ClientEventListener {

}
18 changes: 0 additions & 18 deletions src/main/java/lilypuree/forest_tree/core/setup/ClientProxy.java

This file was deleted.

Loading

0 comments on commit 0a099a0

Please sign in to comment.