Jump to content

Manslaughter777

Members
  • Posts

    99
  • Joined

  • Last visited

Posts posted by Manslaughter777

  1. G' day,

     

    Im trying to make a config file, where if "dirt recipes" is on, allow the user to craft grass and if off, disable the recipe.

    It does not seem to be working though...

     

    This is inside the main class

     

     

    public static boolean dirtRecipe;
        public static Configuration config;
    
        @SubscribeEvent
    public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
    	if(eventArgs.modID.equals(MODID))
    		syncConfig();
    }
        
        public static void syncConfig() {	
        	FMLCommonHandler.instance().bus().register(instance);
        	dirtRecipe = config.getBoolean("Dirt Recipe", Configuration.CATEGORY_GENERAL, true, "Toggle dirt recipes on or off");
    
    	if(config.hasChanged())
    		config.save();
    }
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
        	config = new Configuration(event.getSuggestedConfigurationFile());
            
            //Grass Block
            ItemStack seedStack = new ItemStack(Items.wheat_seeds);
            ItemStack dirtStack = new ItemStack(Blocks.dirt);
            ItemStack grassBlockStack = new ItemStack(Blocks.grass);
                
            if(dirtRecipe) { GameRegistry.addRecipe(grassBlockStack, "a", "b", 'a', seedStack, 'b', dirtStack);}
            
       }
    

     

     

  2. Hello,

     

    Im trying to find an event which is called when the player places a bucket of water or lava. I have found a FillBucketEvent but cant find one for placing the bucket. Is there another event out there that is called when a player places a bucket of water or lava?

     

    Cheers

  3. I have found something that works but still not fully correct.

     

                                                    int boxWidth = 3; 
    
    					double par1 = boxWidth / 2;
    
    					for(int i = 0; i < boxWidth; i++) { 
    						for(int j = 0; j < boxWidth; j++) { 
    							for(int k = 0; k < boxWidth; k++) {
    
    								Item heldItem = player.getHeldItem().getItem();
    								//if(player.getHeldItem().getItem().canHarvestBlock()) 
    								//System.out.println(heldItem.canHarvestBlock(target, player.getHeldItem()));
    
    								int x1 = (int)(x - par1 + i);
    								int y1 = (int)(y - par1 + j);
    								int z1 = (int)(z - par1 + k);
    
    								Block target = world.getBlock(x1, y1, z1);
    								int targetMeta = world.getBlockMetadata(x1, y1, z1);
    
    								if(ForgeHooks.canToolHarvestBlock(target, targetMeta, player.getHeldItem())) {
    									target.harvestBlock(world, player, x1, y1, z1, targetMeta);
    									world.setBlockToAir(x1, y1, z1); 
    								}
    
    							} 
    						}
    					}
    

     

    this seems to work fine only that for some reason dirt doesnt get destroyed???

  4. G' day

     

    Ive made an upgrade for the pickaxe where when you break a block, all surrounding blocks get broken too in a 3x3 area. This works but there is a problem.

     

    B S S

    B S S

    S S S

     

    B = bedrock

    S = stone

     

    Lets say I break the center block, all 9 blocks will break even though im using and iron pickaxe which cant break bedrock. What I need to happen is so that when I break the center block, it will only break the stone (or whatever other block an iron pick can break) butnot the bedrock.

     

    This is inside BlockBreakEvent

                                                    int boxWidth = 3; 
    
    					double par1 = boxWidth / 2;
    
    					for(int i = 0; i < boxWidth; i++) { 
    						for(int j = 0; j < boxWidth; j++) { 
    							for(int k = 0; k < boxWidth; k++) {
    
    								Item heldItem = player.getHeldItem().getItem();
    								//if(player.getHeldItem().getItem().canHarvestBlock()) 
    								//System.out.println(heldItem.canHarvestBlock(target, player.getHeldItem()));
    
    								int x1 = (int)(x - par1 + i);
    								int y1 = (int)(y - par1 + j);
    								int z1 = (int)(z - par1 + k);
    
    								Block target = world.getBlock(x1, y1, z1);
    								int targetMeta = world.getBlockMetadata(x1, y1, z1);
    
    								if(heldItem.canHarvestBlock(target, player.getHeldItem())) {
    									target.harvestBlock(world, player, x1, y1, z1, targetMeta);
    									world.setBlockToAir(x1, y1, z1); 
    								}
    
    							}
    						}
    					}
    

     

    That code still makes the bedrock break, however I have also tried the following which somewhat works:

                                                    int boxWidth = 3; 
    
    					double par1 = boxWidth / 2;
    
    					for(int i = 0; i < boxWidth; i++) { 
    						for(int j = 0; j < boxWidth; j++) { 
    							for(int k = 0; k < boxWidth; k++) {
    
    								Item heldItem = player.getHeldItem().getItem();
    								//if(player.getHeldItem().getItem().canHarvestBlock()) 
    								//System.out.println(heldItem.canHarvestBlock(target, player.getHeldItem()));
    
    								int x1 = (int)(x - par1 + i);
    								int y1 = (int)(y - par1 + j);
    								int z1 = (int)(z - par1 + k);
    
    								Block target = world.getBlock(x1, y1, z1);
    								int targetMeta = world.getBlockMetadata(x1, y1, z1);
    
    								if(world.getBlock((x1, y1, z1) != Blocks.bedrock) {
    									target.harvestBlock(world, player, x1, y1, z1, targetMeta);
    									world.setBlockToAir(x1, y1, z1); 
    								}
    
    							}
    						}
    					}
    

     

    This code DOES work. The pick does not break the bedrock but still breaks the stone. Only problem is that blocks like Obsidian which an iron pick cant mine can still get broken this way.

     

    What looking for is something that checks if the block at the coords at x y z can be broken with the held item, and if so break it, otherwise dont.

     

    Thnx

  5. Delete C:\Users\john\.gradle\caches\2.0\scripts\ completely, seems that the cache got corrupted.

    Still not working, everytime i run it, it seems to never make any files in C:\Users\john\.gradle\caches\2.0\scripts\build_2n89d7nu8105mn84crl2s6oc0q\ProjectScript\buildscript\ which causes it to fail.

     

    Also when i try to launch Minecraft.exe, i get the same message when launching:

    Downloading: https://s3.amazonaws.com/Minecraft.Download/launcher/launcher.pack.lzma (try x/10)

    Exception: java.net.SocketException: Unrecognized Windows Sockets error: 87: create

     

    is it something to do with java?

  6. So im trying to setup forge 1.7.10 and when i run setupDecompWorkspace i get this error:

     

     

     

     

    C:\Users\john\Desktop\Minecraft Mods\forge-1.7.10-10.13.4.1448-1.7.10-src>gradle

    w setupDecompWorkspace

     

    FAILURE: Build failed with an exception.

     

    * What went wrong:

    A problem occurred configuring root project 'forge-1.7.10-10.13.4.1448-1.7.10-sr

    c'.

    > Could not open buildscript class cache for build file 'C:\Users\john\Desktop\M

    inecraft Mods\forge-1.7.10-10.13.4.1448-1.7.10-src\build.gradle' (C:\Users\john\

    .gradle\caches\2.0\scripts\build_2n89d7nu8105mn84crl2s6oc0q\ProjectScript\builds

    cript).

      > java.net.SocketException: Unrecognized Windows Sockets error: 87: Socket cr

    eation failed

     

    * Try:

    Run with --stacktrace option to get the stack trace. Run with --info or --debug

    option to get more log output.

     

    BUILD FAILED

     

    Total time: 3.488 secs

     

    C:\Users\john\Desktop\Minecraft Mods\forge-1.7.10-10.13.4.1448-1.7.10-src>

     

     

     

    Now, ive gone and looked in C:\Users\john\.gradle\caches\2.0\scripts\build_2n89d7nu8105mn84crl2s6oc0q\ProjectScript\buildscript\

    and it is empty!

     

    How can i get the files needed in this folder?

    Thnx

  7. I am really not sure, but this could be a problem with ur java/firewall blocking things that should not be blocked.

    hmm i installed new web security before and it wanted me to delete some files scattered in the cpu, so its probably that. Ill try making a new workspace and see if it works

     

    update: yep its that, it failed to setupDecompWorkspace, gotta redownload forge

  8. Reflection.

     

    Note that MC uses obf names. Use ObfuscationReflectionHelper.

    To get obf name search srg files (or whatever they are called).

     

    Example of getting resourcePack list from Minecraft.class.

    List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao");
    

     

     

    Note that reflection is few times slower. You most certailny don't want to use it per-tick. Use it as litle as possible. Btw - u sure there is no getter for that?

    Check callbacks on those fields (where thay are used).

     

    Ive found another way of doing what i want, so dont worry bout those variables, but ive run into a crash report that i cant even firgure out whats wrong, can u help?

    It happens as soon as i click on the world

     

     

     

    ---- Minecraft Crash Report ----

    // Don't be sad. I'll do better next time, I promise!

     

    Time: 30/06/15 7:12 PM

    Description: Starting integrated server

     

    java.lang.ExceptionInInitializerError

    at net.minecraft.server.MinecraftServer.<init>(MinecraftServer.java:167)

    at net.minecraft.server.integrated.IntegratedServer.<init>(IntegratedServer.java:46)

    at net.minecraft.client.Minecraft.launchIntegratedServer(Minecraft.java:2175)

    at cpw.mods.fml.client.FMLClientHandler.tryLoadExistingWorld(FMLClientHandler.java:669)

    at net.minecraft.client.gui.GuiSelectWorld.func_146615_e(GuiSelectWorld.java:186)

    at net.minecraft.client.gui.GuiSelectWorld$List.elementClicked(GuiSelectWorld.java:266)

    at net.minecraft.client.gui.GuiSlot.drawScreen(GuiSlot.java:251)

    at net.minecraft.client.gui.GuiSelectWorld.drawScreen(GuiSelectWorld.java:222)

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1057)

    at net.minecraft.client.Minecraft.run(Minecraft.java:951)

    at net.minecraft.client.main.Main.main(Main.java:164)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85)

    at GradleStart.main(GradleStart.java:45)

    Caused by: java.lang.IllegalStateException: failed to create a child event loop

    at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:61)

    at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:49)

    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:61)

    at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:52)

    at net.minecraft.network.NetworkSystem.<clinit>(NetworkSystem.java:47)

    ... 20 more

    Caused by: io.netty.channel.ChannelException: failed to open a new selector

    at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:128)

    at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:120)

    at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:87)

    at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:57)

    ... 24 more

    Caused by: java.io.IOException: Unable to establish loopback connection

    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)

    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at sun.nio.ch.PipeImpl.<init>(Unknown Source)

    at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)

    at java.nio.channels.Pipe.open(Unknown Source)

    at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)

    at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)

    at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:126)

    ... 27 more

    Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 87: socket

    at sun.nio.ch.Net.socket0(Native Method)

    at sun.nio.ch.Net.serverSocket(Unknown Source)

    at sun.nio.ch.ServerSocketChannelImpl.<init>(Unknown Source)

    at sun.nio.ch.SelectorProviderImpl.openServerSocketChannel(Unknown Source)

    at java.nio.channels.ServerSocketChannel.open(Unknown Source)

    ... 36 more

     

     

    A detailed walkthrough of the error, its code path and all known details is as follows:

    ---------------------------------------------------------------------------------------

     

    -- Head --

    Stacktrace:

    at net.minecraft.server.MinecraftServer.<init>(MinecraftServer.java:167)

    at net.minecraft.server.integrated.IntegratedServer.<init>(IntegratedServer.java:46)

     

    -- Starting integrated server --

    Details:

    Level ID: New World-

    Level Name: New World

    Stacktrace:

    at net.minecraft.client.Minecraft.launchIntegratedServer(Minecraft.java:2175)

    at cpw.mods.fml.client.FMLClientHandler.tryLoadExistingWorld(FMLClientHandler.java:669)

    at net.minecraft.client.gui.GuiSelectWorld.func_146615_e(GuiSelectWorld.java:186)

    at net.minecraft.client.gui.GuiSelectWorld$List.elementClicked(GuiSelectWorld.java:266)

    at net.minecraft.client.gui.GuiSlot.drawScreen(GuiSlot.java:251)

    at net.minecraft.client.gui.GuiSelectWorld.drawScreen(GuiSelectWorld.java:222)

     

    -- Screen render details --

    Details:

    Screen name: net.minecraft.client.gui.GuiMainMenu

    Mouse location: Scaled: (192, 173). Absolute: (770, 325)

    Screen size: Scaled: (480, 255). Absolute: (1920, 1018). Scale factor of 4

    Stacktrace:

    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)

    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1057)

    at net.minecraft.client.Minecraft.run(Minecraft.java:951)

    at net.minecraft.client.main.Main.main(Main.java:164)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:85)

    at GradleStart.main(GradleStart.java:45)

     

    -- System Details --

    Details:

    Minecraft Version: 1.7.10

    Operating System: Windows 7 (amd64) version 6.1

    Java Version: 1.7.0_51, Oracle Corporation

    Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

    Memory: 965921392 bytes (921 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

    FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active

    mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available

    FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available

    Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available

    moondimension{1.0.0} [The Moon] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available

    Launched Version: 1.7.10

    LWJGL: 2.9.1

    OpenGL: ATI Radeon HD 5450 GL version 3.2.9704 Compatibility Profile Context, ATI Technologies Inc.

    GL Caps: Using GL 1.3 multitexturing.

    Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

    Anisotropic filtering is supported and maximum anisotropy is 16.

    Shaders are available because OpenGL 2.1 is supported.

     

    Is Modded: Definitely; Client brand changed to 'fml,forge'

    Type: Client (map_client.txt)

    Resource Packs: []

    Current Language: English (US)

    Profiler Position: N/A (disabled)

    Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

    Anisotropic Filtering: Off (1)

     

     

  9. It is impossible without some hacky way,since rendering potion is hardcoded in the InventoryEffectRenderer.

    EDIT:

    Also the effect of jumping potion is hardcoded too, so you should implement it yourself if you want it.

    But you can disable all the rendering of potion effects.

    Damn, but i may be able to do an alternative way.

    Do u know if there is a method like isJumping() in the entity class which says if an entity is jumping or off the ground?

  10. You mean like to player, as if he was wearing armor with this enchantement?

    Well, it's not easy.

    It depends of what this enchantement does.

    Enchantements like knockback resistance is easy: just apply enchntement's attribute modifiers each tick.

    Enchantements like looting will require event handling, and advanced dynamic coding.

    Enchantements that are calculated on place of code, where no events exist (like if there were "no falling anvil damage" enchantement), will require asm...

    Feather Falling would be like knockback resistance. How would i apply the enchantments attribute modifiers?

  11. Hey, does anyone know a way i can add an enchantment like feather falling to a player? (not via armor), or direct me to where it is coded when a player is wearing an enchanted piece of armor, do the following?.

     

    Pretty much what i want to do is add "Feather Falling" to the player

     

    Thnx

  12. Whenever i open my custom tool inventory with the I key, it opens just fine, but whenever i try to move and click items it goes all weird. If i click an item, it will pick up another one, and some other item will take its place while it gets moved to a different slot.

     

    Eg:

    Apple is in slot 10.

    Banana is in slot 15.

    Pear is in slot 20.

    if i click on apple on slot 10, i will end up picking up banana and pear will take apple's slot while apple is moved elsewhere.

     

    KeyInputEvent:

     

     

    package com.manslaughter777.moondimension.event;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntityFishHook;
    import net.minecraft.server.MinecraftServer;
    import net.minecraft.world.WorldServer;
    
    import com.manslaughter777.moondimension.Main;
    import com.manslaughter777.moondimension.container.ContainerTool;
    import com.manslaughter777.moondimension.gui.GuiTool;
    import com.manslaughter777.moondimension.items.ItemEnhancedSword;
    import com.manslaughter777.moondimension.settings.KeyBindings;
    
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import cpw.mods.fml.common.gameevent.InputEvent;
    
    public class KeyInputEvent {
    
    @SubscribeEvent
    public void onKeyInput(InputEvent.KeyInputEvent event) {
    
    	EntityPlayer p = Minecraft.getMinecraft().thePlayer;
    
    	//Open Enhanced Tools GUI
    	if(KeyBindings.key_I.isPressed()) {
    
    		if(Minecraft.getMinecraft().thePlayer.getHeldItem().getItem() instanceof ItemEnhancedSword) {
    			p.openGui(Main.instance, Main.guiIDTool, p.worldObj, (int) p.posX, (int) p.posY, (int) p.posZ);
    		}
    
    	}
    }
    
    }
    
    

     

     

     

    Cheers

     

     

  13. Are you trying to turn ALL water blocks to ice? Or is it one or more specific blocks?

     

    If specific, what conditions determine when a water block should freeze?

    Yes, all water blocks to ice. I managed to do this in BlockPlaceEvent, but it only works if the water block is placed from a water block, it doesn't work if its placed with a bucket which is why I'm trying to find an alternate way

  14. player.posX?

    that does work, although it doesnt work well as it is the player's position, not the blocks. So what happens if a player goes next to the water, THEN in turns to ice. What i want is wherever i place water, it turns to ice (thats why i need the blocks pos, not the players).

  15. I need to get a blocks x y and z in the world. How would i go about doing that? (Im used to constructors  and methods giving me these variables)

     

    PlayerTickEvent:

     

     

    @SubscribeEvent
    public void onPlayerTick(TickEvent.PlayerTickEvent event) { //TODO WorldProviderHell
    	EntityPlayer player = event.player;
    	World world = event.player.worldObj;
    
    	//Kill player if no space suit is worn
    	if(!player.capabilities.disableDamage && !player.isPotionActive(Potion.waterBreathing)) {
    		if(world.provider.dimensionId == Main.dimensionId) {
    			if(player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(2) != null && player.getEquipmentInSlot(3) != null && player.getEquipmentInSlot(4) != null) {
    				if(player.getEquipmentInSlot(4).getItem() == Main.spaceHelmet && player.getEquipmentInSlot(3).getItem() == Main.spaceJacket && player.getEquipmentInSlot(2).getItem() == Main.spacePants && player.getEquipmentInSlot(1).getItem() == Main.spaceBoots || player.getEquipmentInSlot(1).getItem() == Main.heavyMoonBoots) {
    
    				} else player.attackEntityFrom(Main.onMoon, 1.0F);
    			} else player.attackEntityFrom(Main.onMoon, 1.0F);
    		}
    	}
    
    	//Change block forms on moon
    	if(world.provider.dimensionId == Main.dimensionId) {
    		if(world.getBlock(x, y, z).getMaterial() == Material.water) { //help here
    			world.setBlock(x, y, z, Blocks.ice);
    		}
    	}
    }
    

     

     

  16. I want to make it so when liquid is placed in my dimension they "freeze". This works fine when i place water from its block, but when i place it from a bucket it does not work...

     

    The PlaceBlock event class:

     

     

    @SubscribeEvent
    public void onBlockPlace(BlockEvent.PlaceEvent event) { 
    	EntityPlayer player = event.player;
    	World world = event.world;
    
    	Block block = event.block;
    	Block placedBlock = event.placedBlock;
    
    	ItemStack heldItem = event.itemInHand;
    
    	int x = event.x;
    	int y = event.y;
    	int z = event.z;
    
    	if(world.provider.dimensionId == Main.dimensionId) {
    
    		if(block.getMaterial() == Material.water) {
    			world.setBlock(x, y, z, Blocks.ice);
    
    		} else if(placedBlock.getMaterial() == Material.lava) {
    			world.setBlock(x, y, z, Blocks.obsidian);
    		}
    	}
    }
    

     

     

×
×
  • Create New...

Important Information

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