Jump to content

Atila1091

Forge Modder
  • Posts

    29
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Atila1091's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. It is called on both sides, thanks.
  2. I created an attribute to set the digging speed in the BreakSpeed event. My question is if the event is called on the client side? Because if it is, I have to call the setShouldWatch(true); method.
  3. It was not a good idea to use this internal method. Looks like I'll have to use reflection.
  4. I already know what causes the problem: When the player dies the capability is marked invalid and returns: LazyOptional.empty () ;. I am currently using a static internal method: ForgeEventFactory.gatherCapabilities. public static IExample getCapability(Entity entityIn) { return ForgeEventFactory.gatherCapabilities(Entity.class, entityIn, null).getCapability(CAPABILITY).orElseThrow(NullPointerException::new); } See the CapabilityProvider class to understand the problem.
  5. Steps: 1- Have a capability. 2 - Get the capability. Example: public static IExample getCapability(Entity entityIn) { return entityIn.getCapability(CAPABILITY).orElseThrow(NullPointerException::new); } 3 - Use an event. Example: PlayerTickEvent. 4 - Kill the player. (/ kill) 5 - The game throws NullPointerException.
  6. I'm creating a block based on the minecraft chorus plant block. To maintain compatibility I'm using the json forge. The question is if I wrote json correctly, although it is working as expected. Forge json: { "forge_marker": 1, "variants": { "north": { "true": { "submodel": "examplemod:chorus_plant_side" }, "false": { "submodel": { "noside": [ { "model": "examplemod:chorus_plant_noside", "weight": 2 }, { "model": "examplemod:chorus_plant_noside1" }, { "model": "examplemod:chorus_plant_noside2" }, { "model": "examplemod:chorus_plant_noside3" } ] } } }, "east": { "true": { "submodel": "examplemod:chorus_plant_side", "y": 90, "uvlock": true }, "false": { "submodel": { "noside1": [ { "model": "examplemod:chorus_plant_noside1", "y": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "y": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside3", "y": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "y": 90, "uvlock": true } ] } } }, "south": { "true": { "submodel": "examplemod:chorus_plant_side", "y": 180, "uvlock": true }, "false": { "submodel": { "noside2": [ { "model": "examplemod:chorus_plant_noside2", "y": 180, "uvlock": true }, { "model": "examplemod:chorus_plant_noside3", "y": 180, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "y": 180, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "y": 180, "uvlock": true } ] } } }, "west": { "true": { "submodel": "examplemod:chorus_plant_side", "y": 270, "uvlock": true }, "false": { "submodel": { "noside3": [ { "model": "examplemod:chorus_plant_noside3", "y": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "y": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "y": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "y": 270, "uvlock": true } ] } } }, "up": { "true": { "submodel": "examplemod:chorus_plant_side", "x": 270, "uvlock": true }, "false": { "submodel": { "noside4": [ { "model": "examplemod:chorus_plant_noside", "weight": 2, "x": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside3", "x": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "x": 270, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "x": 270, "uvlock": true } ] } } }, "down": { "true": { "submodel": "examplemod:chorus_plant_side", "x": 90, "uvlock": true }, "false": { "submodel": { "noside5": [ { "model": "examplemod:chorus_plant_noside3", "x": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside2", "x": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside1", "x": 90, "uvlock": true }, { "model": "examplemod:chorus_plant_noside", "weight": 2, "x": 90, "uvlock": true } ] } } } } } Vanilla: { "multipart": [ { "when": { "north": true }, "apply": { "model": "chorus_plant_side" } }, { "when": { "east": true }, "apply": { "model": "chorus_plant_side", "y": 90, "uvlock": true } }, { "when": { "south": true }, "apply": { "model": "chorus_plant_side", "y": 180, "uvlock": true } }, { "when": { "west": true }, "apply": { "model": "chorus_plant_side", "y": 270, "uvlock": true } }, { "when": { "up": true }, "apply": { "model": "chorus_plant_side", "x": 270, "uvlock": true } }, { "when": { "down": true }, "apply": { "model": "chorus_plant_side", "x": 90, "uvlock": true } }, { "when": { "north": false }, "apply": [ { "model": "chorus_plant_noside", "weight": 2 }, { "model": "chorus_plant_noside1" }, { "model": "chorus_plant_noside2" }, { "model": "chorus_plant_noside3" } ] }, { "when": { "east": false }, "apply": [ { "model": "chorus_plant_noside1", "y": 90, "uvlock": true }, { "model": "chorus_plant_noside2", "y": 90, "uvlock": true }, { "model": "chorus_plant_noside3", "y": 90, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "y": 90, "uvlock": true } ] }, { "when": { "south": false }, "apply": [ { "model": "chorus_plant_noside2", "y": 180, "uvlock": true }, { "model": "chorus_plant_noside3", "y": 180, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "y": 180, "uvlock": true }, { "model": "chorus_plant_noside1", "y": 180, "uvlock": true } ] }, { "when": { "west": false }, "apply": [ { "model": "chorus_plant_noside3", "y": 270, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "y": 270, "uvlock": true }, { "model": "chorus_plant_noside1", "y": 270, "uvlock": true }, { "model": "chorus_plant_noside2", "y": 270, "uvlock": true } ] }, { "when": { "up": false }, "apply": [ { "model": "chorus_plant_noside", "weight": 2, "x": 270, "uvlock": true }, { "model": "chorus_plant_noside3", "x": 270, "uvlock": true }, { "model": "chorus_plant_noside1", "x": 270, "uvlock": true }, { "model": "chorus_plant_noside2", "x": 270, "uvlock": true } ] }, { "when": { "down": false }, "apply": [ { "model": "chorus_plant_noside3", "x": 90, "uvlock": true }, { "model": "chorus_plant_noside2", "x": 90, "uvlock": true }, { "model": "chorus_plant_noside1", "x": 90, "uvlock": true }, { "model": "chorus_plant_noside", "weight": 2, "x": 90, "uvlock": true } ] } ] } To prove that it somehow works, a screenshot taken in minecraft 1.8.9 (The mod will not be 1.8.9, just for testing.) : If there is a simpler and cleaner way to write the forge json with random models, please tell me how to do.
  7. Solved: public class mcreator_tickHandler { @SubscribeEvent public void tick(PlayerTickEvent event) { double posX = event.player.posX; double posZ = event.player.posZ; if (event.player.dimension == mcreator_aether.DIMID && event.player.posY < -2.0D && event.player.ridingEntity == null && event.player.riddenByEntity == null && !event.player.worldObj.isRemote) { event.player.travelToDimension(0); event.player.setPositionAndUpdate(posX, 256.0D, posZ); } } }
  8. I managed to do my work event. It works with many things, but does not work with teleport. Event: public class mcreator_tickHandler { @SubscribeEvent public void tick(PlayerTickEvent event) { if (event.player.dimension == mcreator_sky.DIMID && event.player.posY < -2.0D) { TestEnvironmentMod.teleportPlayerTosky(event.player, true); } } } Teleport: public static TeleporterDimensionMod skyTeleporter; private static void transferPlayer(EntityPlayer player, int dimID, TeleporterDimensionMod tele, boolean aboveWorld) { double posX = player.posX; double posZ = player.posZ; Entity mount = null; Entity mountedBy = null; if (player.worldObj.isRemote) { mcreator_skyOverlays.displayFakeDownload(true); } else { Entity transferMount = player.ridingEntity; Entity transferMountedBy = player.riddenByEntity; if (player.ridingEntity != null) { player.ridingEntity.riddenByEntity = null; } if (player.riddenByEntity != null) { player.riddenByEntity.ridingEntity = null; } player.mountEntity((Entity)null); if (transferMount != null) { mount = teleportEntityTosky(transferMount, aboveWorld); } if (transferMountedBy != null) { transferMountedBy.mountEntity((Entity)null); mountedBy = teleportEntityTosky(transferMountedBy, aboveWorld); } ServerConfigurationManager scm = MinecraftServer.getServer().getConfigurationManager(); scm.transferPlayerToDimension((EntityPlayerMP)player, dimID, tele); if (aboveWorld) { if (mount != null) { mount.setPosition(posX, 256.0D, posZ); } if (mountedBy != null) { mountedBy.setPosition(posX, 256.0D, posZ); } player.setPositionAndUpdate(posX, 256.0D, posZ); } if (mount != null) { player.mountEntity(mount); } if (mountedBy != null) { mountedBy.mountEntity(player); } } } public static void teleportPlayerTosky(EntityPlayer player, boolean aboveWorld) { if (player.dimension == 0) { transferPlayer(player, mcreator_sky.DIMID, skyTeleporter, aboveWorld); } else if (player.dimension == mcreator_sky.DIMID) { transferPlayer(player, 0, skyTeleporter, aboveWorld); } else { transferPlayer(player, mcreator_sky.DIMID, skyTeleporter, aboveWorld); } player.timeUntilPortal = player.getPortalCooldown(); } public static Entity teleportEntityTosky(Entity entity, boolean aboveWorld) { if (!entity.isDead) { boolean newDim = false; int oldDim = entity.dimension; double oldX = entity.posX; double oldZ = entity.posZ; int newDim1; if (oldDim == 0) { newDim1 = mcreator_sky.DIMID; } else if (oldDim == mcreator_sky.DIMID) { newDim1 = 0; } else { newDim1 = mcreator_sky.DIMID; } entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); WorldServer oldServer = minecraftserver.worldServerForDimension(oldDim); WorldServer newServer = minecraftserver.worldServerForDimension(newDim1); entity.dimension = newDim1; entity.worldObj.removeEntity(entity); entity.worldObj.theProfiler.startSection("reposition"); entity.isDead = false; minecraftserver.getConfigurationManager().transferEntityToWorld(entity, oldDim, oldServer, newServer, skyTeleporter); entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), newServer); if (entity1 != null) { entity1.copyDataFrom(entity, true); entity1.timeUntilPortal = entity.getPortalCooldown(); if (aboveWorld) { entity1.setPosition(oldX, 256.0D, oldZ); } entity1.forceSpawn = true; newServer.spawnEntityInWorld(entity1); } entity.isDead = true; entity.worldObj.theProfiler.endSection(); oldServer.resetUpdateEntityTick(); newServer.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); return entity1; } else { return null; } } Crash Report : What did I go wrong again? In the basic course of java I did, I just learned to do a calculator.
  9. My code does not work when I set for EntityPlayerMP. There is no teleport to one player. What I missed? import mod.mcreator.mcreator_sky; import mod.mcreator.mcreator_sky.TeleporterDimensionMod; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.relauncher.Side; public class TickInGame { private int tickCounter; @SubscribeEvent public void onTick(TickEvent.ServerTickEvent event) { if (event.side == Side.SERVER && event.phase == TickEvent.Phase.START) { this.tick(event.type); } } public Entity p_149670_5_; public void tick(TickEvent.Type type) { if ((p_149670_5_ instanceof EntityPlayerMP)) { EntityPlayerMP thePlayer = (EntityPlayerMP)p_149670_5_; if (((EntityPlayer)(thePlayer)).dimension == mcreator_sky.DIMID && ((EntityPlayer)(thePlayer)).posY < -2D) { Class class1 = null; NBTTagCompound nbttagcompound = new NBTTagCompound(); if (((EntityPlayer)(thePlayer)).ridingEntity != null) { class1 = ((EntityPlayer)(thePlayer)).ridingEntity.getClass(); ((EntityPlayer)(thePlayer)).ridingEntity.writeToNBT(nbttagcompound); ((EntityPlayer)(thePlayer)).ridingEntity.setDead(); } double d = ((EntityPlayer)(thePlayer)).motionY; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mcreator_sky.DIMID, new TeleporterDimensionMod(thePlayer.mcServer.worldServerForDimension(mcreator_sky.DIMID))); ((EntityPlayer)(thePlayer)).setLocationAndAngles(((EntityPlayer)(thePlayer)).posX, 127D, ((EntityPlayer)(thePlayer)).posZ, ((EntityPlayer)(thePlayer)).rotationYaw, 0.0F); if (class1 != null && !thePlayer.worldObj.isRemote) { Object obj = null; try { Entity entity1 = (Entity)class1.getDeclaredConstructor(new Class[] { net.minecraft.world.World.class }).newInstance(new Object[] { thePlayer.worldObj }); entity1.readFromNBT(nbttagcompound); entity1.setLocationAndAngles(((EntityPlayer)(thePlayer)).posX, 127D, ((EntityPlayer)(thePlayer)).posZ, ((EntityPlayer)(thePlayer)).rotationYaw, 0.0F); thePlayer.worldObj.spawnEntityInWorld(entity1); thePlayer.mountEntity(entity1); } catch (Exception exception) { System.out.println("Failed to transfer mount."); } } thePlayer.motionX = thePlayer.motionZ = 0.0D; thePlayer.motionY = d; } } } } Please help me! And thank you!
  10. Continued: http://www.minecraftforge.net/forum/index.php/topic,31550.0.html
  11. I have not found someone to help me really. :'( To solve this topic I decompiled the Aether mod 1.2.5 using the MCP, but only 90% of my poblema was completed. http://www.minecraftforge.net/forum/index.php/topic,31521.0.html The public void usePortal(int par1, Teleporter teleporter) it does not exist anymore. I need something to replace it: minecraft.usePortal(((BlockAetherPortal)AetherBlocks.Portal).getDimNumber(minecraft.thePlayer), teleporter); The code adapted to 1.7.10: public class TickHandler { private int tickCounter; @SubscribeEvent public void onTick(TickEvent.ServerTickEvent event) { if (event.side == Side.SERVER && event.phase == TickEvent.Phase.START) { this.onTickInGame(event.type); } } public void onTickInGame(TickEvent.Type type) { if (Minecraft.getMinecraft().thePlayer != null) { EntityClientPlayerMP entityplayersp = Minecraft.getMinecraft().thePlayer; if (((EntityPlayer)(entityplayersp)).dimension == mcreator_aether.DIMID && ((EntityPlayer)(entityplayersp)).posY < -2D) { Class class1 = null; NBTTagCompound nbttagcompound = new NBTTagCompound(); if (((EntityPlayer)(entityplayersp)).ridingEntity != null) { class1 = ((EntityPlayer)(entityplayersp)).ridingEntity.getClass(); ((EntityPlayer)(entityplayersp)).ridingEntity.writeToNBT(nbttagcompound); ((EntityPlayer)(entityplayersp)).ridingEntity.setDead(); } double d = ((EntityPlayer)(entityplayersp)).motionY; minecraft.usePortal(((BlockAetherPortal)AetherBlocks.Portal).getDimNumber(minecraft.thePlayer), teleporter); Minecraft.getMinecraft().thePlayer.setLocationAndAngles(((EntityPlayer)(entityplayersp)).posX, 256D, ((EntityPlayer)(entityplayersp)).posZ, ((EntityPlayer)(entityplayersp)).rotationYaw, 0.0F); if (class1 != null && !Minecraft.getMinecraft().theWorld.isRemote) { Object obj = null; try { Entity entity1 = (Entity)class1.getDeclaredConstructor(new Class[] { net.minecraft.world.World.class }).newInstance(new Object[] { Minecraft.getMinecraft().theWorld }); entity1.readFromNBT(nbttagcompound); entity1.setLocationAndAngles(((EntityPlayer)(entityplayersp)).posX, 256D, ((EntityPlayer)(entityplayersp)).posZ, ((EntityPlayer)(entityplayersp)).rotationYaw, 0.0F); Minecraft.getMinecraft().theWorld.spawnEntityInWorld(entity1); entityplayersp.mountEntity(entity1); } catch (Exception exception) { System.out.println("Failed to transfer mount."); } } if (Minecraft.getMinecraft().gameSettings.difficulty == EnumDifficulty.PEACEFUL) { entityplayersp.fallDistance = -64F; } } } } } Who can help me, please write in java, but do not try to explain why I learned Java alone. :'( This is very important for me because I'm developing a dimension at the sky with my ideas and how the sky is necessary that there is a teleport if a Player fall out of the island. The code is almost perfect even though the minecraft 1.2.5. Please help me. :'( :'( :'(
  12. How can I make the player teleport to the surface world after falling from a dimension as the Aether mod do? Normal is the player taking damage, which I want to avoid. Please anyone who can help make the class ready, because I never had a lesson of java in life. This is very important for my mod. Translated by google translator.
  13. To remove all edit base class of my mod following the advice of diesieben07 I do resouvir the bucket with water or lava enable my two portals to the sky and hell hard, but new problems appeared: To achieve my objective I recreated the bucket of minecraft and removed the original recipe. The new Class: But the bucket of milk depends on the cow: /** * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. */ public boolean interact(EntityPlayer p_70085_1_) { ItemStack itemstack = p_70085_1_.inventory.getCurrentItem(); if (itemstack != null && itemstack.getItem() == Items.bucket && !p_70085_1_.capabilities.isCreativeMode) { if (itemstack.stackSize-- == 1) { p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, new ItemStack(Items.milk_bucket)); } else if (!p_70085_1_.inventory.addItemStackToInventory(new ItemStack(Items.milk_bucket))) { p_70085_1_.dropPlayerItemWithRandomChoice(new ItemStack(Items.milk_bucket, 1, 0), false); } return true; } else { return super.interact(p_70085_1_); } } I want my new bucket has the same function as minecraft bucket, but do not know how. Please anyone who can help make the class ready, because I never had a lesson of java in life. This is very important for my mod. Translated by google translator.
×
×
  • Create New...

Important Information

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