Jump to content

sblectric

Forge Modder
  • Posts

    34
  • Joined

  • Last visited

Everything posted by sblectric

  1. There is a 1.8.9 version that mods use, and it works fine.
  2. Store the BlockPos in the item's NBT and read it when right-clicking.
  3. Nope, it's not needed. Debug mode is only needed if you're changing some code.
  4. No, this is for having entities spawn naturally in biomes, not in a specific circumstance like qxjl1010 needs.
  5. Yeah, pretty sure that's a bug with shields in particular. I tried doing pretty much exactly that in my Advanced Addons mod, and the "blocking" model would never work, no matter what I tried. To make matters worse, the shield functionality isn't even exposed, so I had to use an event handler to mimic the blocking damage to the shield. Shields are not too easy to extend!
  6. You can either color the stem yourself, or leave it grayscale and color it via an IBlockColor implementation.
  7. Waila does that for even vanilla crops, so I wouldn't worry about it.
  8. Ahh yeah, I can see how putting into an inventory and such could be a bit tricky.
  9. I'm pretty sure it's just reading from NBT, so nothing really hacky here.
  10. I solved my problem. I had to iterate over all the active log4j loggers like so: LoggerContext ctx = (LoggerContext)LogManager.getContext(false); Collection<LoggerConfig> lc = ctx.getConfiguration().getLoggers().values(); for(LoggerConfig c : lc) { c.addFilter(new SpamFilter()); }
  11. You could always wait for the item to be held in the item update method, then when the status changes, write it to the ItemStack's NBT. Then, read that NBT from the ItemStack in the hasEffect method.
  12. It seems that there can only be one log4j.xml file per classpath, and Minecraft's is taking precedence. Is there any way to get around that?
  13. Oh, I see what you're saying. I'll look into it, thanks.
  14. I don't want it to be a static file in the jar, I want it to be configurable. Still looking into the XML format for log4j, I don't know what I'm saying.
  15. Here's my code atm, showing Java and Apache logger filters, called from the preInit phase: // Java LogManager m = LogManager.getLogManager(); Enumeration<String> names = m.getLoggerNames(); while(names.hasMoreElements()) { String name = names.nextElement(); m.getLogger(name).setFilter(new SpamFilter()); } // Apache Logger root = (Logger)org.apache.logging.log4j.LogManager.getRootLogger(); root.addFilter(new SpamFilter()); and here's the SpamFilter class: package sblectric.logspamfilter.filter; import java.util.logging.LogRecord; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.Filter.Result; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.message.Message; import sblectric.logspamfilter.config.FilterConfig; /** The spam filter class for all logging */ public class SpamFilter implements java.util.logging.Filter, Filter { /** All other filtering methods call this one */ public static Result filter(String message) { System.out.println("Message available"); for(String s : FilterConfig.spamBlackList) { if (message.toLowerCase().contains(s.toLowerCase())) { return Result.DENY; } } return null; } @Override public boolean isLoggable(LogRecord record) { return filter(record.getMessage()) != Result.DENY; } @Override public Result filter(LogEvent event) { return filter(event.getMessage().toString()); } @Override public Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) { return filter(msg); } @Override public Result filter(Logger arg0, Level arg1, Marker arg2, Message msg, Throwable arg4) { return filter(msg.toString()); } @Override public Result filter(Logger arg0, Level arg1, Marker arg2, Object arg3, Throwable arg4) { return null; } @Override public Result getOnMatch() { return null; } @Override public Result getOnMismatch() { return null; } } The only time the static "filter" method was called was when MY mod's logger logged its status (the filter is working there), and not any of the other FML / MC stuff being logged.
  16. I've tried adding filters to the root logger (org.apache.logging.log4j.LogManager.getRootLogger()) like in this Bukkit example, as well as the Java loggers, but nothing is working. I've even tried redirecting System.out and System.err. Any ideas? EDIT: Solved.
  17. You need the getDescriptionPacket and onDataPacket methods for it to save.
  18. This issue stemmed from the fact that I was returning the wrong DimensionType from my WorldProvider class. I changed it to the one I registered the dimension with and everything works perfectly now.
  19. After the Forge recommended build for 1.9 fixed sounds (1887), I have noticed that mob sounds of all types (vanilla and custom), as well as things like chest animations and sounds are still not working in my custom dimension, whereas they work perfectly in the overworld. Pretty much everything else in the custom dimension is working. Is there something I'm missing?
  20. That's because you actually have to know what the methods are doing. I have a feeling you don't have a firm grasp of java. The correct implementation is if(fuel.getItem() == Item.getItemFromBlock(MABlocks.CompressedCoalBlock)) return 80000;
  21. What IDE are you using? Most should toss you an error if you attempt to compare incompatible objects like that.
  22. It may be useful to others searching for similar issues if you posted your solution.
  23. I ended up fixing this crash by adding the following to my WorldProvider class: @Override public void onPlayerAdded(EntityPlayerMP p) { int cx = ((int)p.posX) >> 4; int cz = ((int)p.posZ) >> 4; for(int x = cx - 1; x <= cx + 1; x++) { for(int z = cz - 1; z <= cz + 1; z++) { this.worldObj.getChunkProvider().provideChunk(x, z); } } } which basically preloads a 3x3 chunk area centered on the player before the above crash could happen. It's a bit strange, but it works.
×
×
  • Create New...

Important Information

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