Jump to content

Alastar

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by Alastar

  1. Posting my build.gradle that did the trick(Used ShadowJar due to inability to did it with Forge Gradle) seems like the only way to do it now : buildscript { repositories { jcenter() mavenCentral() maven { name = "forge" url = "http://files.minecraftforge.net/maven" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' } } apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'java' // or 'groovy'. Must be explicitly applied apply plugin: 'com.github.johnrengelman.shadow' version = "0.7.1.26" group = "minedonate" archivesBaseName = "minedonate" [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' sourceCompatibility = targetCompatibility = '1.8' compileJava { sourceCompatibility = targetCompatibility = '1.8' } minecraft { version = "1.12.2-14.23.0.2491" runDir = "run" mappings = "snapshot_20170612" makeObfSourceJar = false } configurations { shadow compile.extendsFrom shadow } dependencies { shadow 'org.apache.commons:commons-dbcp2:2.1.1' shadow 'org.apache.commons:commons-pool2:2.4.2' shadow 'mysql:mysql-connector-java:8.0.11' } shadowJar { archiveName = tasks.jar.archiveName configurations = [project.configurations.shadow] relocate 'org.apache.commons', 'ru.alastar.org.shadowedlibs.org.apache.commons' } jar { configurations.shadow.each { dep -> from(project.zipTree(dep)){ exclude 'META-INF', 'META-INF/**' } } } jar.dependsOn shadowJar jar.enabled = false processResources { inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' expand 'version': project.version, 'mcversion': project.minecraft.version } from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } }
  2. I shaded apache-dbcp2 into my .jar, but when server reaches any usage of this library's classes - it throws NoClassDefFoundError: [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: Caused by: java.lang.NoClassDefFoundError: org/apache/commons/dbcp2/BasicDataSource [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at ru.alastar.minedonate.rtnl.ModDataBase.getDataBaseConnection(ModDataBase.java:38) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at ru.alastar.minedonate.rtnl.ModDataBase.initDataBase(ModDataBase.java:132) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: ... 43 more [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp2.BasicDataSource [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at java.net.URLClassLoader.findClass(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:106) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:-1]: ... 45 more [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: java.lang.NullPointerException [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at ru.alastar.minedonate.rtnl.ModDataBase.getDataBaseConnection(ModDataBase.java:26) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at ru.alastar.minedonate.rtnl.ModDataBase.getNewStatement(ModDataBase.java:65) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at ru.alastar.minedonate.MineDonate.loadServerMerch(MineDonate.java:95) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at ru.alastar.minedonate.proxies.ServerProxy.preInit(ServerProxy.java:65) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at ru.alastar.minedonate.MineDonate.preInit(MineDonate.java:654) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at java.lang.reflect.Method.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:627) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at java.lang.reflect.Method.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.EventBus.post(EventBus.java:217) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at java.lang.reflect.Method.invoke(Unknown Source) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at com.google.common.eventbus.EventBus.post(EventBus.java:217) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.LoadController.redirect$onPost$zza000(LoadController.java:560) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:627) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:332) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486) [20:02:37] [Server thread/INFO] [STDERR]: [ru.alastar.minedonate.MineDonate:loadServerMerch:118]: at java.lang.Thread.run(Unknown Source) On the 1.7.10 everything worked fine
  3. This problem is driving me mad. I've created another empty item class and got the same error
  4. On server side I'm giving item to player with: InfoItem itemInfo = m_Infos.get(s); if (itemInfo != null) { EntityPlayerMP player = (EntityPlayerMP) MinecraftServer.getServer().getEntityWorld().getPlayerEntityByName(s1); if (player != null) { ItemStack stack = new ItemStack(itemInfo); itemInfo.writeNBT(stack); stack.setStackDisplayName(s); player.inventory.addItemStackToInventory(stack); player.addChatMessage(new ChatComponentText("You were given a " + s + "!")); } } I keep different item info in hashmap and attaching it in nbt when instantiating it. This throws next error on client: InfoItem is just empty item class: public class InfoItem extends Item { public HashMap<RandomRange, ItemStack> m_Items; public CaseItem(String aCase) { super(); this.setUnlocalizedName(aCase); this.setCreativeTab(CreativeTabs.tabMisc); this.setTextureName(CaseMod.MODID + ":info"); } public void writeNBT(ItemStack stack){ NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound items = new NBTTagCompound(); for (RandomRange randomRange : m_Items.keySet()) { ItemStack st = m_Items.get(randomRange); NBTTagCompound compound = new NBTTagCompound(); st.writeToNBT(compound); compound.setInteger("rarity", randomRange.getRarity()); items.setTag(st.getDisplayName(), compound); } tag.setTag("info_items", items); stack.setTagCompound(tag); } }
  5. up
  6. He said "discharge"... not that I can understand what he means anyway... I mean add damage to item) Like in Industrial Craft. Item: public void DischargeFilter(int amt, EntityPlayer player) { if(hasFilterFounded == false) { for(int m = 0; m < 100; m++) { ItemStack filter = new ItemStack(apocalypse.Filter,1,m); for(int i = 0; i < player.inventory.getSizeInventory(); i++) { ItemStack item = player.inventory.getStackInSlot(i); if(item != null) { if(item.isItemEqual(filter)) { hasFilterFounded = true; item.damageItem(amt, player); } } } } } hasFilterFounded = false; } Block: public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if(par5Entity instanceof EntityPlayer) { ItemStack respirator = new ItemStack(apocalypse.Respirator, 1); if(((EntityPlayer) par5Entity).getCurrentItemOrArmor(4) == null || !respirator.isItemEqual(((EntityPlayer) par5Entity).getCurrentItemOrArmor(4))) { if(((AGeneralRespirator) respirator.getItem()).hasFilterLoaded((EntityPlayer) par5Entity) == false) { Debug.log("Entering gas without respirator!"); par5Entity.attackEntityFrom(DamageSource.drown, damage); ((EntityLiving) par5Entity).addPotionEffect(Effect); } if(((EntityPlayer) par5Entity).getCurrentItemOrArmor(4) == null) { par5Entity.attackEntityFrom(DamageSource.drown, damage); ((EntityLiving) par5Entity).addPotionEffect(Effect); } } else if(respirator.isItemEqual(((EntityPlayer) par5Entity).getCurrentItemOrArmor(4))) { if(((AGeneralRespirator) respirator.getItem()).hasFilterLoaded((EntityPlayer) par5Entity) == false) { Debug.log("Entering gas without respirator!"); par5Entity.attackEntityFrom(DamageSource.drown, damage); ((EntityLiving) par5Entity).addPotionEffect(Effect); } ((AGeneralRespirator) respirator.getItem()).DischargeFilter(GasStrength, (EntityPlayer) par5Entity); } } }
  7. I'm add damage to item when player stay in specific block, but I got in a trouble - item fully discharge once player stay at this block. I really think about ticks and threads, but can't invent something working.
  8. I know. But how i can detect it by metadata range? I represent, how it must work, maybe there is another method to make this?
  9. How to detect same items with different damage?
  10. You need to check before if both are not null, like: item1 != null Thank you! It's working.
  11. item1.isItemEqual(item2) crashes client((
  12. How I can do this?
  13. How can I get the armor item in the armor slot? Whats wrong? public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if(par5Entity instanceof EntityPlayer) { if(((EntityLiving) par5Entity).getCurrentItemOrArmor(1) != new ItemStack(apocalypse.Respirator)) { Debug.log("Entering gas without respirator!"); par5Entity.attackEntityFrom(DamageSource.drown, damage); } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.