-
Content Count
796 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Kokkie
-
How do I get the player with the packet?
-
To what side do I send it, I guess MP
-
I'm sorry, I'm not getting this and probably this is simple as fk but I'm not getting this
-
I don't really get it, how can I get the EntityPlayer that has opened the gui class
-
How can I do that, with a Tile-Entity?
-
I know, I only check the xp on client side and change it in the block class on server side but it is with a pretty hacky way that only works if 1 player does it at a time
-
1. Use the normal font 2. Explain
-
I would suggest doing AxisAlignedBB bb = playerIn.getEntityBoundingBox().expand(20.0D, 20.0D, 20.0D) and for hurting them something like this: List<EntityLivingBase> entitiesInAABB = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, bb); for(int i = 0; i < entitiesInAABB.size(); i++) { EntityLivingBase entityInAABB = entitiesInAABB.get(i); entityInAABB.attackEntityFrom(DamageSource.magic, 1.0F); }
-
So, I have made a gui that will, after some texts, trade xp - cookies but I need a player instance for me to check the xp, give a cookie and take xp, I have something that works, but it won't work if multiple people use it at the same time, this is what I have come up with: The gui class: public class CookieGui extends GuiScreen { public static GuiSlider cookies; public boolean slider = false; public EntityPlayer player = Minecraft.getMinecraft().thePlayer; public static boolean cookiesC = false; public static boolean cookiesS = false; @Override public void initGui() { slider = false; cookiesC = false; cookiesS = false; buttonList.add(new GuiButtonExt(1, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Goed geopend!")); cookies = new GuiSlider(8, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Ik wil ", " koekjes", 1, 64, 1, true, true); } @Override protected void actionPerformed(GuiButton button) throws IOException { switch(button.id) { case 1 : buttonList.removeAll(buttonList); buttonList.add(new GuiButtonExt(2, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Stop!")); break; case 2 : buttonList.removeAll(buttonList); buttonList.add(new GuiButtonExt(3, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Ik zei STOP!")); break; case 3 : buttonList.removeAll(buttonList); buttonList.add(new GuiButtonExt(4, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Nooit luisteren he")); break; case 4 : buttonList.removeAll(buttonList); buttonList.add(new GuiButtonExt(5, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Wil je een koekje?")); buttonList.add(new GuiButtonExt(6, width / 2 - 100, height / 4 + 72 + -16, 75, 20, "Ja")); buttonList.add(new GuiButtonExt(7, width / 2 + 25, height / 4 + 72 + -16, 75, 20, "Nee")); break; case 5 : buttonList.removeAll(buttonList); buttonList.add(new GuiButtonExt(8, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Mahn, niet op klikken")); buttonList.add(new GuiButtonExt(9, width / 2 - 100, height / 4 + 72 + -16, 200, 20, "Terug naar koekjes")); break; case 6 : buttonList.removeAll(buttonList); buttonList.add(cookies); buttonList.add(new GuiButtonExt(10, width / 2 - 100, height / 4 + 72 + -16, 200, 20, "Ok")); slider = true; break; case 7 : buttonList.removeAll(buttonList); this.mc.displayGuiScreen((GuiScreen)null); break; case 8 : break; case 9 : buttonList.removeAll(buttonList); buttonList.add(new GuiButtonExt(5, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Wil je een koekje?")); buttonList.add(new GuiButtonExt(6, width / 2 - 100, height / 4 + 72 + -16, 75, 20, "Ja")); buttonList.add(new GuiButtonExt(7, width / 2 + 25, height / 4 + 72 + -16, 75, 20, "Nee")); break; case 10 : buttonList.removeAll(buttonList); slider = false; if(!player.isCreative()) { if(player.experienceLevel >= 3 * cookies.getValueInt()) { cookiesS = true; buttonList.add(new GuiButtonExt(11, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Alsjeblieft")); } else { buttonList.add(new GuiButtonExt(7, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Je hebt niet genoeg xp")); } } else { cookiesC = true; buttonList.add(new GuiButtonExt(11, width / 2 - 100, height / 4 + 42 + -16, 200, 20, "Alsjeblieft")); } break; case 11 : CheeseCookieBlock.remove(); cookiesC = false; cookiesS = false; this.mc.displayGuiScreen((GuiScreen)null); break; } } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { if(slider) { drawCenteredString(fontRendererObj, "Je krijgt " + String.valueOf(cookies.getValueInt()) + " koekjes, dat is " + String.valueOf(cookies.getValueInt() * 3) + " XP levels" , width / 2, height / 4 + 102 + -16, 0xFFFFFF); } super.drawScreen(mouseX, mouseY, partialTicks); } } The block class: public class CookieBlock extends Block { public static EntityPlayer player; public CookieBlock () { super(Material.ROCK); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { player = playerIn; playerIn.openGui(MainClass.Instance, GuiHandler.COOKIEGUIID, worldIn, pos.getX(), pos.getY(), pos.getZ()); return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); } public static void remove() { if(CookieGui.cookiesC) { player.inventory.addItemStackToInventory(new ItemStack(Items.COOKIE, CookieGui.cookies.getValueInt())); player.addStat(KokkieAchievements.COOKIE); } else if(CookieGui.cookiesS) { player.inventory.addItemStackToInventory(new ItemStack(Items.COOKIE, CookieGui.cookies.getValueInt())); player.removeExperienceLevel(3 * CookieGui.cookies.getValueInt()); player.addStat(KokkieAchievements.COOKIE); } } }
-
It works, THANKS!!!
-
I now have this, will it work? StructureBoundingBox structureboundingbox = new StructureBoundingBox(chunkpos.getXStart() - 16, 0, chunkpos.getZStart() - 16, chunkpos.getXEnd() + 16, 256, chunkpos.getZEnd() + 16);
-
[SOLVED]Registered Fluid correctly, getting weird texture error
Kokkie replied to Mattizin's topic in Modder Support
Maybe inside the .mcmeta files? -
Hello, I have a mod and I have a biome with a structure spawning in it but when it generates it sometimes is just fine but sometimes also spawns with a lot missing, my code: public class WorldGenSimpleHouse extends WorldGenerator { private static final BlockStateMatcher IS_GRASS = BlockStateMatcher.forBlock(Blocks.GRASS); private final ResourceLocation HOUSE = new ResourceLocation(Reference.MODID + ":house"); public boolean generate(World worldIn, Random rand, BlockPos position) { while (worldIn.isAirBlock(position) && position.getY() > 2) { position = position.down(); } if (!IS_GRASS.apply(worldIn.getBlockState(position))) { return false; } Random random = worldIn.getChunkFromChunkCoords(position.getX(), position.getZ()).getRandomWithSeed(987234911L); Rotation[] arotation = Rotation.values(); Rotation rotation = arotation[random.nextInt(arotation.length)]; ChunkPos chunkpos = new ChunkPos(position); StructureBoundingBox structureboundingbox = new StructureBoundingBox(chunkpos.getXStart(), 0, chunkpos.getZStart(), chunkpos.getXEnd(), 256, chunkpos.getZEnd()); PlacementSettings placementsettings = (new PlacementSettings()).setRotation(rotation).setBoundingBox(structureboundingbox).func_189950_a(random); MinecraftServer minecraftserver = worldIn.getMinecraftServer(); TemplateManager templatemanager = worldIn.getSaveHandler().getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, HOUSE); template.func_189962_a(worldIn, position, placementsettings, 2); return true; } } And my decorate method in my biome class public void decorate(World worldIn, Random rand, BlockPos pos) { double d0 = GRASS_COLOR_NOISE.getValue((double) (pos.getX() + / 200.0D, (double) (pos.getZ() + / 200.0D); final WorldGenSimpleHouse HOUSE_GENERATOR = new WorldGenSimpleHouse(); if (rand.nextInt(1500) == 0) { int i = rand.nextInt(16) + 8; int j = rand.nextInt(16) + 8; BlockPos blockpos = worldIn.getHeight(pos.add(i, 0, j)).up(); HOUSE_GENERATOR.generate(worldIn, rand, blockpos); System.out.println("House generated at: X" + blockpos.getX() + ", Z" + blockpos.getZ()); } this.theBiomeDecorator.flowersPerChunk = 4; this.theBiomeDecorator.grassPerChunk = 10; DOUBLE_PLANT_GENERATOR.setPlantType(BlockDoublePlant.EnumPlantType.GRASS); for (int i = 0; i < 7; ++i) { int j = rand.nextInt(16) + 8; int k = rand.nextInt(16) + 8; int l = rand.nextInt(worldIn.getHeight(pos.add(j, 0, k)).getY() + 32); DOUBLE_PLANT_GENERATOR.generate(worldIn, rand, pos.add(j, l, k)); } super.decorate(worldIn, rand, pos); }
-
Oh wait, found that the credits must be 1 string, not in brackets
-
Hello, I have a logo for my mod and put it in my mcmod.info but when I launch the game the mcmod.info is not working but without the logo it does work [ { "modid": "sm", "name": "Simple Mod", "description": "Simple mod", "version": "1.0", "mcversion": "1.10.2", "url": "", "updateUrl": "", "authorList": ["Kokkie1989"], "credits": ["Estabist","Frikandel1998"], "logoFile": "assets/sm/textures/logo.png", "screenshots": [], "dependencies": [] } ] and the error in the console: [20:39:49] [Client thread/ERROR] [FML]: The mcmod.info file in bin cannot be parsed as valid JSON. It will be ignored com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) ~[ReflectiveTypeAdapterFactory$Adapter.class:?] at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?] at com.google.gson.Gson.fromJson(Gson.java:841) ~[Gson.class:?] at net.minecraftforge.fml.common.MetadataCollection.from(MetadataCollection.java:72) [MetadataCollection.class:?] at net.minecraftforge.fml.common.discovery.DirectoryDiscoverer.exploreFileSystem(DirectoryDiscoverer.java:76) [DirectoryDiscoverer.class:?] at net.minecraftforge.fml.common.discovery.DirectoryDiscoverer.discover(DirectoryDiscoverer.java:60) [DirectoryDiscoverer.class:?] at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:49) [ContainerType.class:?] at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:78) [ModCandidate.class:?] at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:141) [ModDiscoverer.class:?] at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:380) [Loader.class:?] at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:506) [Loader.class:?] at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:216) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_77] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_77] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_77] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY at com.google.gson.internal.bind.JsonTreeReader.nextString(JsonTreeReader.java:154) ~[JsonTreeReader.class:?] at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:358) ~[TypeAdapters$13.class:?] at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:346) ~[TypeAdapters$13.class:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) ~[ReflectiveTypeAdapterFactory$1.class:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) ~[ReflectiveTypeAdapterFactory$Adapter.class:?] ... 27 more I checked jsonlint.org but it is valid json
-
First of, 1.7.10 is no longer supported and as soon as diesieben sees this he will delete it, second you can't use Minecraft.getMinecraft().* for getting something to change because the Minecraft class is client only and changes are made server side and third: put code in a Code[/Code] thing