Skip to content

Commit

Permalink
pre-release commit 1.5.4
Browse files Browse the repository at this point in the history
rotatable signs / road blocks with multiple heights
  • Loading branch information
E-Mans-Application committed May 11, 2021
1 parent 6c3ecd4 commit 494fcba
Show file tree
Hide file tree
Showing 670 changed files with 6,745 additions and 31,917 deletions.
142 changes: 92 additions & 50 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,77 +1,119 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
mavenCentral()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

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 = "1.5.2-mc1.12.2" //<modversion>-mc<minecraftversion>
version = "1.5.4-mc1.12.2" //<modversion>-mc<minecraftversion>
group = "derfl007.roads" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "df-roads"

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

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

minecraft {
version = "1.12.2-14.23.5.2772"
runDir = "run"

// 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.
// 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 = "snapshot_20171003"
// Simply re-run your setup task after changing the mappings to update your workspace.
//mappings channel: 'snapshot', version: '20171003-1.12'
mappings channel: 'snapshot', version: '20171003-1.12'
// 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 {
client {
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'
}

server {

// 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'
}
}
}

dependencies {
// 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"

// 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

// the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
//provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
// except that these dependencies get remapped to your current MCP mappings
//deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
//deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// for more info...
// 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.12.2-14.23.5.2855'

// 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"

// 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

// The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
// provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// These dependencies get remapped to your current MCP mappings
// deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'

// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

}

processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version

// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
// Example for how to get properties into the manifest for reading by the runtime..
jar {
manifest {
attributes([
"Specification-Title": "examplemod",
"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")
])
}

// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}

// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')

publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}
}
}
16 changes: 13 additions & 3 deletions src/main/java/derfl007/roads/RecipesSign.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package derfl007.roads;

import static derfl007.roads.init.RoadBlocks.*;

import derfl007.roads.init.RoadItems;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import static derfl007.roads.init.RoadBlocks.*;

@SuppressWarnings("Duplicates")
public class RecipesSign {
Expand Down Expand Up @@ -116,6 +115,17 @@ public class RecipesSign {
road_sign_info_17b, //end of town sign
road_sign_info_23, // two lanes merge into one
road_sign_info_23b, // two lanes merge into one (german)
road_sign_info_24,
road_sign_info_25a,
road_sign_info_25b,
road_sign_info_26a,
road_sign_info_26b,
road_sign_info_26c,
road_sign_info_27a,
road_sign_info_27b,
road_sign_info_27c,
road_sign_info_28a,
road_sign_info_28b,
};

public static Block[] signs_3 = {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/derfl007/roads/Reference.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.minecraft.util.text.TextComponentString;

public class Reference {

public static final int TICK_RATE = 20;

public static void sayDebugChat(EntityPlayer player, String string) {
player.sendStatusMessage(new TextComponentString("[DEBUG]: " + string), true);
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/derfl007/roads/Roads.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package derfl007.roads;

import java.io.File;

import org.apache.logging.log4j.Logger;

import derfl007.roads.common.commands.CommandTrafficLights;
Expand Down Expand Up @@ -33,6 +35,7 @@
import derfl007.roads.world.WorldGenOre;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
Expand All @@ -46,7 +49,7 @@
import net.minecraftforge.server.permission.DefaultPermissionLevel;
import net.minecraftforge.server.permission.PermissionAPI;

@Mod(modid = "df-roads", useMetadata = true, updateJSON = "https://raw.githubusercontent.com/derfl007/df-roads/master/update.json")
@Mod(modid = "df-roads", useMetadata = true, updateJSON = "https://raw.githubusercontent.com/E-Mans-Application/df-roads/master/update.json")
public class Roads {

@Instance(Reference.MOD_ID)
Expand All @@ -67,17 +70,26 @@ public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(proxy);
PacketHandler.init();
RoadTileEntities.register();

proxy.preInit();
logger = event.getModLog();
}

@EventHandler
public void init(FMLInitializationEvent event) {

System.out.println("Init");

Configuration config = new Configuration(new File("config/df-roads.cfg"));
config.load();

boolean generateAsphalt = config.get("general", "generate_asphalt", true).getBoolean();
config.save();

NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
proxy.init();
GameRegistry.registerWorldGenerator(new WorldGenOre(), 0);
if (generateAsphalt)
GameRegistry.registerWorldGenerator(new WorldGenOre(), 0);

RoadCrafting.register();
MinecraftForge.EVENT_BUS.register(new ServerTickHandler());
PermissionAPI.registerNode("dfroads.command.trafficlights", DefaultPermissionLevel.ALL,
Expand Down
55 changes: 45 additions & 10 deletions src/main/java/derfl007/roads/RoadsTab.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,57 @@
package derfl007.roads;

import java.util.Comparator;

import com.google.common.collect.Ordering;

import derfl007.roads.init.RoadBlocks;
import derfl007.roads.init.RoadItems;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;

public class RoadsTab extends CreativeTabs implements Comparator<ItemStack> {

public RoadsTab() {
super("tabRoads");

}

@Override
public ItemStack getTabIconItem() {
return new ItemStack(RoadBlocks.road_line[2]);
}

@Override
public void displayAllRelevantItems(NonNullList<ItemStack> items) {
super.displayAllRelevantItems(items);
items.sort(this);
}

public class RoadsTab extends CreativeTabs {
@Override
public int compare(ItemStack o1, ItemStack o2) {
// TODO Auto-generated method stub
Block b1 = Block.getBlockFromItem(o1.getItem());
Block b2 = Block.getBlockFromItem(o2.getItem());

public RoadsTab() {
super("tabRoads");
int i1 = RoadBlocks.RegistrationHandler.BLOCKS.indexOf(b1);
int i2 = RoadBlocks.RegistrationHandler.BLOCKS.indexOf(b2);

}
if (i1 >= 0 && i2 >= 0) {
return i1 - i2;
}
if (i1 >= 0) {
return -1;
}
if (i2 >= 0) {
return 1;
}

@Override
public ItemStack getTabIconItem()
{
return new ItemStack(RoadBlocks.road_line);
}
i1 = RoadItems.RegistrationHandler.ITEMS.indexOf(o1.getItem());
i2 = RoadItems.RegistrationHandler.ITEMS.indexOf(o2.getItem());

return i1 - i2;

}
}
26 changes: 18 additions & 8 deletions src/main/java/derfl007/roads/SignsTab.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
package derfl007.roads;

import com.google.common.collect.Ordering;

import derfl007.roads.init.RoadBlocks;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;

public class SignsTab extends CreativeTabs {

public SignsTab() {
super("tabSigns");
}
public SignsTab() {
super("tabSigns");
}

@Override
public ItemStack getTabIconItem() {
return new ItemStack(RoadBlocks.road_sign_priority_2);
}
@Override
public ItemStack getTabIconItem() {
return new ItemStack(RoadBlocks.road_sign_priority_2);
}

}
@Override
public void displayAllRelevantItems(NonNullList<ItemStack> items) {
super.displayAllRelevantItems(items);
items.sort(Ordering.explicit(RoadBlocks.RegistrationHandler.BLOCKS)
.onResultOf((ItemStack item) -> Block.getBlockFromItem(item.getItem())));
}
}
Loading

0 comments on commit 494fcba

Please sign in to comment.