
Enderlook
Members-
Posts
45 -
Joined
-
Last visited
Enderlook's Achievements

Tree Puncher (2/8)
0
Reputation
-
Ok, I've changed just to try: baseName = 'extracraftcore-1.0' baseName = 'extracraft-1.0' And when I run "gradlew.bat build fullBuild" I get this error: FAILURE: Build failed with an exception. * What went wrong: Failed to create MD5 hash for file C:\Juegos\Minecraft\Codding\forge-1.12.2-14.23.4.2705-mdk\.gradle\2.14\taskArtifacts\cache.properties.lock. And then it says in Spanish something like "The process doesn't have access to the file because another process has blocked a part of the file". I don't know what to do
-
I've tried to do the same as you but it isn't working:: version = "1.0" group = "net.enderlook.extracraftcore" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "extracraftcore" // [...] task extracraftcore(type: Jar) { baseName = 'extracraftcore' from('etc/extracraftcore') { include '*.info','pack.mcmeta' expand 'version': '1.0', 'mcversion': project.minecraft.version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { include 'net/enderlook/extracraftcore/**', 'assets/extracraftcore/**' exclude '**.xcf', 'net/enderlook/extracraft/**', 'assets/extracraft/**' } } task extracraft(type: Jar) { baseName = 'extracraft' from('etc/extracraft') { include '*.info','pack.mcmeta' expand 'version': '1.0', 'mcversion': project.minecraft.version } from zipTree(jar.outputs.getFiles().getSingleFile()).matching { include 'net/enderlook/extracraft/**', 'assets/extracraft/**' exclude '**.xcf', 'net/enderlook/extracraftcore/**', 'assets/extracraftcore/**' } } extracraft.dependsOn('extracraftcore') task releaseJars(type: Copy) { from extracraftcore from extracraft //one of these lines crashes it? rename '-(.*)jar', '.jar' rename '-(.*)zip', '.zip' into '.' } task fullBuild(type: Delete) { delete jar } fullBuild.dependsOn('releaseJars') Also, I've noted something strange on your mod that I don't understand: Your "mcmod.info" is the default of forge (examplemod) (In my mcmod.info I've two dictionaries {}, one for extracraft and another for extracraftcore ).
-
I've made two mods: Extracraft Core: this mod has my custom classes which inherit from Item and Block. Extracraft: This mod import that classes and with them creates items and blocks. I made this because I've planned in the future to make several mods and I don't want in each one have to make that classes, so I want to have a "core" mod which is used by all of them. The strange this is that when I try to compile the mods it produces to jars: Extracraft-1.0.jar Extracraft-1.0-sources.jar And if I drag the first file in the mod folder, both mods appear in Minecraft, so: It seems that the second file is useless. "Physically" in the mod folder there is only 1 jar, but "virtually" in the Minecraft mod button you can see 2 mods. So it seems that both mods get fussed in the same jar file. I compile them using "gradle.bat build" and in the build.gradle I wrote: version = "1.0" group = "net.enderlook.extracrafcore" archivesBaseName = "extracraftcore" If I let the values as default (com.example.modid) it also works but the file change of name... So my questions are: Is fine my idea of split the "common" code between my mods into a "core/lib/whatever" mod? Or is it a bit stupid/lazy? How can I split that .jar into two .jar (one for each mod)? What is the usage of Extracraft-1.0-sources.jar? If when I use "gradle.bat build" gradle compile all my mods, What would happen if I have a lot of mods? Is there a way to as gradle to only compile an specific mod? Thanks in advance!
-
1.12.2 How to make a life steal enchantment by percentage [SOLVED]
Enderlook replied to Enderlook's topic in Modder Support
Ups, I've forgotten that. And which method is better? Register them like I do, or in the other way? -
1.12.2 How to make a life steal enchantment by percentage [SOLVED]
Enderlook replied to Enderlook's topic in Modder Support
... isn't "@SubscribeEvent" the way to register the event? I've another event registered in that way (for another enchantment) and they work. All of them are registered in the same class under the "@EventBusSubscriber(modid=ExtraCraft.MOD_ID)" -
1.12.2 How to make a life steal enchantment by percentage [SOLVED]
Enderlook replied to Enderlook's topic in Modder Support
Ok, I've tried with this code (and the same with LivingDamageEvent) but it seems don't work: @SubscribeEvent public void vampire(LivingAttackEvent event) { Object attacker = event.getSource().getTrueSource(); if (attacker instanceof EntityLivingBase) { EntityLivingBase entityAttacker = (EntityLivingBase)attacker; if(!entityAttacker.getEntityWorld().isRemote) { int level = EnchantmentHelper.getEnchantmentLevel(ENCHANTEMNT_VAMPIRISM, entityAttacker.getHeldItemMainhand()); entityAttacker.heal(event.getAmount() * (level / 5)); } } } What am I doing wrong? -
Actually, I have done one: @Override public void onEntityDamaged (EntityLivingBase user, Entity target, int level) { user.heal(1 + level); } ... But I have a problem, this heals the player a flat amount. My idea is to heal the player a percentage of the damage dealt to the target. How can I get the amount of damaged provoked to the enemy in order to calculate my life steal?
-
I'm not sure what you mean with "try using the player", but note that if I replace my block ModBlocks.PETRIFY_OBSIDIAN_BLOCK to Blocks.OBSIDIAN (I mean, a vanilla block) it works fine. That is why I think it may be a problem with the block. I'm sorry but I don't know how to use that IDE's tools, so I'll do my best. I've set a breakpoint in that line and open debug mode. It says: event LivingEvent$LivingUpdateEvent (id=419) level 1 entity EntityPlayerMP (id=424) entityLiving EntityPlayerMP (id=424) world WorldServer (id=431) r 3 pos BlockPos (id=436) x -1 z -2 blockpos BlockPos (id=697) iblockstate BlockStateContainer$StateImplementation (id=440) It seems that there isn't any null in that variables. But... If I add this line before the breakpoint: BlockPetrifyObsidian a = ModBlocks.BLOCK_PETRIFY_OBSIDIAN; I can see: getMaterial() returned MaterialLogic (id=462) event LivingEvent$LivingUpdateEvent (id=418) level 1 entity EntityPlayerMP (id=423) entityLiving EntityPlayerMP (id=423) world WorldServer (id=430) r 3 pos BlockPos (id=435) x -2 z -2 blockpos BlockPos (id=438) iblockstate BlockStateContainer$StateImplementation (id=439) a null That "a" ---> my custom block, is null. So, if both things (the block and the event) are registered automatically with "@SubscribeEvent", how can I ask Minecraft/Forge to initialize first the block and then the event? Or I don't know, whatever it must be done.
-
I know, the line 69 is: if (iblockstate.getMaterial() == Material.LAVA && (iblockstate.getBlock() == Blocks.LAVA || iblockstate.getBlock() == Blocks.FLOWING_LAVA) && world.mayPlace(ModBlocks.BLOCK_PETRIFY_OBSIDIAN, blockpos, false, EnumFacing.DOWN, (Entity)null)) { I'm quite sure the null may be `ModBlocks.BLOCK_PETRIFY_OBSIDIAN`, that is why I'm asking how can I fix it. That block is initialized automatically by Minecraft: @EventBusSubscriber(modid = ExtraCraft.MOD_ID) public class ModBlocks { // [...] @ObjectHolder(ExtraCraft.MOD_ID + ":petrify_obsidian_block") public static final BlockPetrifyObsidian BLOCK_PETRIFY_OBSIDIAN = null; // [...] } And also the enchantment is initialized by Minecraft: @EventBusSubscriber(modid=ExtraCraft.MOD_ID) public class ModEnchantments { // [...] @SubscribeEvent public static void stonewalker(LivingUpdateEvent event) { // [...] } } So I don't know how to fix it.
-
I've made a custom block, called `petrify_obsidian` (just a basic block) in order to spawn it with my "stone_walker". But each time I try to use my enchantment it crashes the game, and if I replace it with normal obsidian, it doesn't. What am I doing wrong? I just changed `Blocks.OBSIDIAN` to `ModBlocks.PETRIFY_OBSIDIAN_BLOCK`. I think the problem may be with the way I register it, but not sure. @EventBusSubscriber(modid = ExtraCraft.MOD_ID) public class ModBlocks { @ObjectHolder(ExtraCraft.MOD_ID + ":petrify_obsidian_block") public static final BlockPetrifyObsidian BLOCK_PETRIFY_OBSIDIAN = null; private static CBlockBasic[] BLOCK_BASIC; public static void init() { BLOCK_BASIC = new CBlockBasic[] { new BlockPetrifyObsidian() }; } @SideOnly(Side.CLIENT) public static void initializeBlockModels() { for (CBlockBasic block : BLOCK_BASIC) { block.initializeModel(); } }; @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); registry.registerAll(BLOCK_BASIC); }; @SubscribeEvent public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { for (CBlockBasic block : BLOCK_BASIC) { block.registerItemBlock(event); } } } Init is called on: @Mod(modid = ExtraCraft.MOD_ID, name = ExtraCraft.NAME, version = ExtraCraft.VERSION) @EventBusSubscriber(modid = ExtraCraft.MOD_ID) public class ExtraCraft implements IProxy { // [...] @Override @EventHandler public void preInitializationEvent(FMLPreInitializationEvent event) { ModBlocks.init(); } // [...] } I think that the registration of my enchantment event is being done before my block initialization (null exception), but I don't know how to change the order. Description: Ticking player java.lang.NullPointerException: Ticking player at net.minecraft.world.World.mayPlace(World.java:3435) at net.enderlook.extracraft.init.ModEnchantments.stonewalker(ModEnchantments.java:69) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_8_ModEnchantments_stonewalker_LivingUpdateEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182) at net.minecraftforge.common.ForgeHooks.onLivingUpdate(ForgeHooks.java:566) at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2312) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:423) at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:185) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:212) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) at java.lang.Thread.run(Unknown Source) What can I do?