V0.2
This commit is contained in:
parent
f8c9982f8b
commit
92921c3e80
|
@ -2,4 +2,5 @@
|
|||
Better With Chemistry Modpack Tweaks
|
||||
|
||||
## thanks to
|
||||
[Shadowfacts](https://shadowfacts.net/) so much, because he has awesome mod doc. for [1.12](https://shadowfacts.net/tutorials/forge-modding-112)
|
||||
[Darkorg69](https://github.com/Darkorg69), because I copied some code from [this repo](https://github.com/Darkorg69/Better-Punching)
|
|
@ -2,7 +2,7 @@
|
|||
Source installation information for modders
|
||||
-------------------------------------------
|
||||
This code follows the Minecraft Forge installation methodology. It will apply
|
||||
some small patches to the vanilla MCP source code, giving you and it access
|
||||
some small patches to the vanilla MCP source code, giving you and it access
|
||||
to some of the data and functions you need to build a successful mod.
|
||||
|
||||
Note also that the patches are built against "unrenamed" MCP source code (aka
|
||||
|
@ -22,7 +22,7 @@ Step 1: Open your command-line and browse to the folder where you extracted the
|
|||
Step 2: You're left with a choice.
|
||||
If you prefer to use Eclipse:
|
||||
1. Run the following command: "gradlew genEclipseRuns" (./gradlew genEclipseRuns if you are on Mac/Linux)
|
||||
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
||||
2. Open Eclipse, Import > Existing Gradle Project > Select Folder
|
||||
or run "gradlew eclipse" to generate the project.
|
||||
(Current Issue)
|
||||
4. Open Project > Run/Debug Settings > Edit runClient and runServer > Environment
|
||||
|
@ -36,7 +36,7 @@ If you prefer to use IntelliJ:
|
|||
|
||||
If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again.
|
||||
|
||||
Should it still not work,
|
||||
Should it still not work,
|
||||
Refer to #ForgeGradle on EsperNet for more information about the gradle environment.
|
||||
or the Forge Project Discord discord.gg/UvedJ9m
|
||||
|
||||
|
@ -47,7 +47,7 @@ installation process, no further action is required on your part.
|
|||
|
||||
LexManos' Install Video
|
||||
=======================
|
||||
https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be
|
||||
https://yewtu.be/watch?v=8VEdtQLuLO0 (link edited by mertoalex)
|
||||
|
||||
For more details update more often refer to the Forge Forums:
|
||||
http://www.minecraftforge.net/forum/index.php/topic,14048.0.html
|
||||
|
|
10
build.gradle
10
build.gradle
|
@ -13,9 +13,9 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.12.2-0.1'
|
||||
group = 'io.mertoalex.bwcmpTweaks' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'bwcmpTweaks'
|
||||
version = '1.12.2-0.2'
|
||||
group = 'io.mertoalex.bwcmp_tweaks' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'bwcmp_tweaks'
|
||||
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
|
||||
|
||||
|
@ -114,3 +114,7 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main { output.resourcesDir = output.classesDir }
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package io.mertoalex.bwcmpTweaks; //I Don't have any domain btw
|
||||
|
||||
//import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = bwcmpTweaks.MODID, name = bwcmpTweaks.NAME, version = bwcmpTweaks.VERSION)
|
||||
public class bwcmpTweaks {
|
||||
public static final String MODID = "bwcmptweaks";
|
||||
public static final String NAME = "Bwcmp Tweaks";
|
||||
public static final String VERSION = "0.1";
|
||||
|
||||
public static final Logger Logger = LogManager.getLogger(bwcmpTweaks.MODID);
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// some example code
|
||||
Logger.info("bwcmpTweakes inited!");
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package io.mertoalex.bwcmpTweaks.event; // actually I copied some codes from https://github.com/Darkorg69/Better-Punching to there
|
||||
|
||||
import io.mertoalex.bwcmpTweaks.bwcmpTweaks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = bwcmpTweaks.MODID)
|
||||
public class ForgeEvents {
|
||||
@SubscribeEvent
|
||||
public static void onPunchWood(PlayerEvent.BreakSpeed event) {
|
||||
IBlockState state = event.getState();
|
||||
if (state.getMaterial() == Material.WOOD) {
|
||||
ItemStack stack = event.getEntityPlayer().getHeldItemMainhand();
|
||||
//bwcmpTweaks.Logger.info("[*] " + stack.getItem());
|
||||
if (!(stack.getItem() instanceof ItemAxe)) {
|
||||
event.setNewSpeed(-1.0F); return;
|
||||
} event.setNewSpeed(event.getOriginalSpeed());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package io.mertoalex.bwcmp_tweaks; //I Don't have any domain btw
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.item.ModItems;
|
||||
import io.mertoalex.bwcmp_tweaks.proxy.CommonProxy;
|
||||
import io.mertoalex.bwcmp_tweaks.event.ForgeEvents;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
//import net.minecraft.init.Blocks;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = bwcmpTweaks.MODID, name = bwcmpTweaks.NAME, version = bwcmpTweaks.VERSION)
|
||||
public class bwcmpTweaks {
|
||||
public static final String MODID = "bwcmp_tweaks";
|
||||
public static final String NAME = "Bwcmp Tweaks";
|
||||
public static final String VERSION = "0.2";
|
||||
|
||||
public static final Logger Logger = LogManager.getLogger(bwcmpTweaks.MODID);
|
||||
|
||||
@SidedProxy(serverSide = "io.mertoalex.bwcmp_tweaks.proxy.CommonProxy", clientSide = "io.mertoalex.bwcmp_tweaks.proxy.ClientProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static final Item.ToolMaterial rockTM = EnumHelper.addToolMaterial("ROCK", 0, 16, 2, 1, 0);//(name, harvestLevel, maxUses, efficiency, damage, enchantability)
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// some example code
|
||||
Logger.info("[*] bwcmpTweakes inited!");
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
MinecraftForge.EVENT_BUS.register(ForgeEvents.class);
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public static class RegistrationHandler {
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event) {
|
||||
ModItems.register(event.getRegistry());
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void registerItems(ModelRegistryEvent event) {
|
||||
ModItems.registerModels();
|
||||
}
|
||||
}
|
||||
}
|
||||
//minecraft:tallgrass
|
|
@ -0,0 +1,58 @@
|
|||
package io.mertoalex.bwcmp_tweaks.event; // actually I copied some codes from https://github.com/Darkorg69/Better-Punching to there
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.bwcmpTweaks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = bwcmpTweaks.MODID)
|
||||
public class ForgeEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPunchWood(PlayerEvent.BreakSpeed event) {
|
||||
IBlockState state = event.getState();
|
||||
if (state.getMaterial() == Material.WOOD) {
|
||||
ItemStack stack = event.getEntityPlayer().getHeldItemMainhand();
|
||||
//bwcmpTweaks.Logger.info("[*] " + stack.getItem());
|
||||
if (!(stack.getItem() instanceof ItemAxe)) {
|
||||
event.setNewSpeed(-1.0F); return;
|
||||
} event.setNewSpeed(event.getOriginalSpeed());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onHarverstBlock(BlockEvent.HarvestDropsEvent event) {
|
||||
/*bwcmpTweaks.Logger.info("Hi from outside of GRASS.");
|
||||
bwcmpTweaks.Logger.info(event.getState().getBlock().toString());*/
|
||||
if(event.getState().getBlock().toString().toLowerCase().contains("tallgrass")) {
|
||||
//bwcmpTweaks.Logger.info("Hi from inside GRASS.");
|
||||
ItemStack stack = event.getHarvester().getHeldItemMainhand();
|
||||
//bwcmpTweaks.Logger.info("[*] " + stack.getItem());
|
||||
if ((stack.getItem() instanceof ItemSword)) {
|
||||
event.setDropChance(0.35f);
|
||||
event.getDrops().add(new ItemStack(Item.getByNameOrId("bwcmp_tweaks:grass_fiber")));
|
||||
stack.damageItem(1, event.getHarvester());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onHarverstLeave(BlockEvent.HarvestDropsEvent event) {
|
||||
if(event.getState().getBlock().toString().toLowerCase().contains("leave")) {
|
||||
ItemStack stack = event.getHarvester().getHeldItemMainhand();
|
||||
//bwcmpTweaks.Logger.info("[*] " + stack.getItem());
|
||||
if ((stack.getItem() instanceof ItemSword)) {
|
||||
event.getDrops().add(new ItemStack(Item.getByNameOrId("minecraft:stick")));
|
||||
stack.damageItem(1, event.getHarvester());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package io.mertoalex.bwcmp_tweaks.item;
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.bwcmpTweaks;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemBase extends Item {
|
||||
protected String name;
|
||||
|
||||
public ItemBase(String name) {
|
||||
this.name = name;
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(name);
|
||||
}
|
||||
|
||||
public void registerItemModel() {
|
||||
bwcmpTweaks.proxy.registerItemRenderer(this, 0, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemBase setCreativeTab(CreativeTabs tab) {
|
||||
super.setCreativeTab(tab);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package io.mertoalex.bwcmp_tweaks.item;
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.bwcmpTweaks;
|
||||
import io.mertoalex.bwcmp_tweaks.item.tool.ItemAxe;
|
||||
import io.mertoalex.bwcmp_tweaks.item.tool.ItemSword;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public class ModItems {
|
||||
public static ItemBase grassFiber = new ItemBase("grass_fiber").setCreativeTab(CreativeTabs.MATERIALS);
|
||||
public static ItemSword grassCutter = new ItemSword(bwcmpTweaks.rockTM , "grass_cutter");
|
||||
public static ItemAxe primitiveAxe = new ItemAxe(bwcmpTweaks.rockTM , "primitive_axe");
|
||||
|
||||
public static void register(IForgeRegistry<Item> registry) {
|
||||
registry.registerAll(
|
||||
grassFiber,
|
||||
grassCutter,
|
||||
primitiveAxe
|
||||
);
|
||||
//OreDictionary.registerOre("stickWood", Items.STICK);
|
||||
OreDictionary.registerOre("rock", Items.FLINT);
|
||||
}
|
||||
|
||||
public static void registerModels (){
|
||||
grassFiber.registerItemModel ();
|
||||
grassCutter.registerItemModel ();
|
||||
primitiveAxe.registerItemModel ();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package io.mertoalex.bwcmp_tweaks.item.tool;
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.bwcmpTweaks;
|
||||
//import net.minecraft.item.Item;
|
||||
|
||||
public class ItemAxe extends net.minecraft.item.ItemAxe {
|
||||
|
||||
private String name;
|
||||
|
||||
public ItemAxe(ToolMaterial material, String name) {
|
||||
super(material, 8f, -3.1f);
|
||||
setRegistryName(name);
|
||||
setUnlocalizedName(name);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void registerItemModel(/*Item item*/) {
|
||||
bwcmpTweaks.proxy.registerItemRenderer(this, 0, name);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package io.mertoalex.bwcmp_tweaks.item.tool;
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.bwcmpTweaks;
|
||||
//import net.minecraft.item.Item;
|
||||
|
||||
public class ItemSword extends net.minecraft.item.ItemSword {
|
||||
private String name;
|
||||
|
||||
public ItemSword(ToolMaterial material, String name) {
|
||||
super(material);
|
||||
setRegistryName(name);
|
||||
setUnlocalizedName(name);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void registerItemModel(/*Item item*/) {
|
||||
bwcmpTweaks.proxy.registerItemRenderer(this, 0, name);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package io.mertoalex.bwcmp_tweaks.proxy;
|
||||
|
||||
import io.mertoalex.bwcmp_tweaks.bwcmpTweaks;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
public void registerItemRenderer(Item item, int meta, String id) {
|
||||
ModelLoader.setCustomModelResourceLocation(item, meta,
|
||||
new ModelResourceLocation(bwcmpTweaks.MODID + ":" + id, "inventory"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package io.mertoalex.bwcmp_tweaks.proxy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class CommonProxy {
|
||||
public void registerItemRenderer(Item item, int meta, String id) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
item.grass_fiber.name=Grass fiber
|
||||
item.grass_cutter.name=Grass cutter
|
||||
item.primitive_axe.name=Primitive axe
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"type": "item",
|
||||
"name": "minecraft:tallgrass",
|
||||
"conditions": [{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"item": "bwcmp_tweaks:grass_cutter"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"functions": [{
|
||||
"function": "mymod:myfunction",
|
||||
"foobar": 3 // can require custom parameters in deserializer
|
||||
}
|
||||
]
|
||||
}
|
||||
/*{
|
||||
"type": "minecraft:block",
|
||||
"pools": [{
|
||||
"rolls": 1,
|
||||
"entries": [{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [{
|
||||
"condition": "minecraft:alternative",
|
||||
"terms": [{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"item": "bwcmp_tweaks:grass_cutter"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "bwcmp_tweaks:grass_fiber"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}*/
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"textures": {
|
||||
"layer0": "bwcmp_tweaks:items/grass_cutter"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "bwcmp_tweaks:items/grass_fiber"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"textures": {
|
||||
"layer0": "bwcmp_tweaks:items/primitive_axe"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"R",
|
||||
"S"
|
||||
],
|
||||
"key": {
|
||||
"R": {
|
||||
"type": "forge:ore_dict",
|
||||
"ore": "rock"
|
||||
},
|
||||
"S": {
|
||||
"type": "forge:ore_dict",
|
||||
"ore": "stickWood"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "bwcmp_tweaks:grass_cutter"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"pattern": [
|
||||
"FR",
|
||||
"S "
|
||||
],
|
||||
"key": {
|
||||
"F": {
|
||||
"item": "bwcmp_tweaks:grass_fiber"
|
||||
},
|
||||
"R": {
|
||||
"type": "forge:ore_dict",
|
||||
"ore": "rock"
|
||||
},
|
||||
"S": {
|
||||
"type": "forge:ore_dict",
|
||||
"ore": "stickWood"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "bwcmp_tweaks:primitive_axe"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 376 B |
Binary file not shown.
After Width: | Height: | Size: 1012 B |
Binary file not shown.
After Width: | Height: | Size: 611 B |
Loading…
Reference in New Issue