Search In
• More options...
Find results that contain...
Find results in...  # yanksrock1019

Members

193

## Everything posted by yanksrock1019

1. First of all, you dont have to be rude, this is a support forum where you go to figure out how to do things that you don't know. Second, I did not copy paste vanilla code, I wrote that code in my Teleporter class. Third, yes, I do just want to create a custom fire. Here is the code: public boolean tryToCreatePortal(World world, int x, int y, int z){ byte b = 0; byte b1 = 0; if(world.getBlock(x-1, y, z) == PupletBlocks.pupletOre || world.getBlock(x+1, y, z) == PupletBlocks.pupletOre){ b = 1; } if(world.getBlock(x, y, z-1) == PupletBlocks.pupletOre || world.getBlock(x, y, z+1) == PupletBlocks.pupletOre){ } if(b == b1){ return false; }else{ if(world.isAirBlock(x-b, y, z-b1)){ x-=b; z-=b1; } for(int i = -1; i <= 2; i++){ for(int j = -1; j <= 3; j++){ boolean flag = (i == -1 || i == 2 || j == -1 || j == 3); if(i != -1 && i != 2 || j != -1 && j != 3){ Block k = world.getBlock(x + (b*i), y+j, z+(b1*i)); boolean isAirBlock = world.isAirBlock(x + b*i, y+j, z + b1*i); if(flag){ if(k != PupletBlocks.pupletOre){ return false; } }else if(!isAirBlock && k != PupletBlocks.blockTeleporterFire){ return false; } } } } for(int l = 0; l < 2; l++){ for(int l2 = 0; l2 < 3; l2++){ world.setBlock(x + b*l, y + l2, z + b1*l, PupletBlocks.blockTeleporter, 0, 2); } } return true; } }
2. This? public boolean makePortal(Entity p_85188_1_) { byte b0 = 16; double d0 = -1.0D; int i = MathHelper.floor_double(p_85188_1_.posX); int j = MathHelper.floor_double(p_85188_1_.posY); int k = MathHelper.floor_double(p_85188_1_.posZ); int l = i; int i1 = j; int j1 = k; int k1 = 0; int l1 = this.random.nextInt(4); int i2; double d1; int k2; double d2; int i3; int j3; int k3; int l3; int i4; int j4; int k4; int l4; int i5; double d3; double d4; for (i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - p_85188_1_.posX; for (k2 = k - b0; k2 <= k + b0; ++k2) { d2 = (double)k2 + 0.5D - p_85188_1_.posZ; label274: for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if (this.worldServerInstance.isAirBlock(i2, i3, k2)) { while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { --i3; } for (j3 = l1; j3 < l1 + 4; ++j3) { k3 = j3 % 2; l3 = 1 - k3; if (j3 % 4 >= 2) { k3 = -k3; l3 = -l3; } for (i4 = 0; i4 < 3; ++i4) { for (j4 = 0; j4 < 4; ++j4) { for (k4 = -1; k4 < 4; ++k4) { l4 = i2 + (j4 - 1) * k3 + i4 * l3; i5 = i3 + k4; int j5 = k2 + (j4 - 1) * l3 - i4 * k3; if (k4 < 0 && !this.worldServerInstance.getBlock(l4, i5, j5).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) { continue label274; } } } } d3 = (double)i3 + 0.5D - p_85188_1_.posY; d4 = d1 * d1 + d3 * d3 + d2 * d2; if (d0 < 0.0D || d4 < d0) { d0 = d4; l = i2; i1 = i3; j1 = k2; k1 = j3 % 4; } } } } } } if (d0 < 0.0D) { for (i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - p_85188_1_.posX; for (k2 = k - b0; k2 <= k + b0; ++k2) { d2 = (double)k2 + 0.5D - p_85188_1_.posZ; label222: for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if (this.worldServerInstance.isAirBlock(i2, i3, k2)) { while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { --i3; } for (j3 = l1; j3 < l1 + 2; ++j3) { k3 = j3 % 2; l3 = 1 - k3; for (i4 = 0; i4 < 4; ++i4) { for (j4 = -1; j4 < 4; ++j4) { k4 = i2 + (i4 - 1) * k3; l4 = i3 + j4; i5 = k2 + (i4 - 1) * l3; if (j4 < 0 && !this.worldServerInstance.getBlock(k4, l4, i5).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) { continue label222; } } } d3 = (double)i3 + 0.5D - p_85188_1_.posY; d4 = d1 * d1 + d3 * d3 + d2 * d2; if (d0 < 0.0D || d4 < d0) { d0 = d4; l = i2; i1 = i3; j1 = k2; k1 = j3 % 2; } } } } } } } int k5 = l; int j2 = i1; k2 = j1; int l5 = k1 % 2; int l2 = 1 - l5; if (k1 % 4 >= 2) { l5 = -l5; l2 = -l2; } boolean flag; if (d0 < 0.0D) { if (i1 < 70) { i1 = 70; } if (i1 > this.worldServerInstance.getActualHeight() - 10) { i1 = this.worldServerInstance.getActualHeight() - 10; } j2 = i1; for (i3 = -1; i3 <= 1; ++i3) { for (j3 = 1; j3 < 3; ++j3) { for (k3 = -1; k3 < 3; ++k3) { l3 = k5 + (j3 - 1) * l5 + i3 * l2; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2 - i3 * l5; flag = k3 < 0; this.worldServerInstance.setBlock(l3, i4, j4, flag ? PupletBlocks.pupletOre : Blocks.air); } } } } for (i3 = 0; i3 < 4; ++i3) { for (j3 = 0; j3 < 4; ++j3) { for (k3 = -1; k3 < 4; ++k3) { l3 = k5 + (j3 - 1) * l5; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2; flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3; this.worldServerInstance.setBlock(l3, i4, j4, (Block)(flag ? PupletBlocks.pupletOre : PupletBlocks.blockTeleporter), 0, 2); } } for (j3 = 0; j3 < 4; ++j3) { for (k3 = -1; k3 < 4; ++k3) { l3 = k5 + (j3 - 1) * l5; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2; this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4)); } } } return true; } /** * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a * WorldServer.getTotalWorldTime() value. */ public void removeStalePortalLocations(long p_85189_1_) { if (p_85189_1_ % 100L == 0L) { @SuppressWarnings("rawtypes") Iterator iterator = this.destinationCoordinateKeys.iterator(); long j = p_85189_1_ - 600L; while (iterator.hasNext()) { Long olong = (Long)iterator.next(); TeleporterPuplet.PortalPosition portalposition = (TeleporterPuplet.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); if (portalposition == null || portalposition.lastUpdateTime < j) { iterator.remove(); this.destinationCoordinateCache.remove(olong.longValue()); } } } }
3. Nope, didn't help
4. *bump*
5. I am trying to create a flame that lights a portal. It lights the portal in the other dimension it leads to but not the overworld. Can't figure out why package com.puplet.blocks; import static net.minecraftforge.common.util.ForgeDirection.DOWN; import static net.minecraftforge.common.util.ForgeDirection.EAST; import static net.minecraftforge.common.util.ForgeDirection.NORTH; import static net.minecraftforge.common.util.ForgeDirection.SOUTH; import static net.minecraftforge.common.util.ForgeDirection.UP; import static net.minecraftforge.common.util.ForgeDirection.WEST; import com.puplet.dimension.dimensionRegistry; import net.minecraft.block.BlockFire; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; public class BlockTeleporterFire extends BlockFire{ public BlockTeleporterFire(){ super(); } public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) { return null; } public int getRenderType() { return 3; } public void onBlockAdded(World par1World, int par2, int par3, int par4) { /** Change these to your portal frame and Portal block **/ if (par1World.getBlock(par2, par3 - 1, par4) != PupletBlocks.pupletOre || !((BlockTeleporter) PupletBlocks.blockTeleporter).tryToCreatePortal(par1World, par2, par3, par4)) { if ((!par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)) && (!canNeighborBurn(par1World, par2, par3, par4))) { par1World.setBlockToAir(par2, par3, par4); } else { par1World.scheduleBlockUpdate(par2, par3, par4, this, tickRate(par1World) + par1World.rand.nextInt(10)); } } } private boolean canNeighborBurn(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_) { return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) || this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) || this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH); } }
6. I am trying to create a portal into my custom dimension, however I am getting this error. I have looked around and can't see anything wrong. Error: TeleporterBlock: Teleporter:
7. You're right, what I really wanted to do was to just make it into a potion
8. So why when I use this.setCreativeTabs it adds all vanilla potions to my tab
9. I think I may be missing something here, because I see no answer in getSubItems. Please point out what you are talking about
10. Sorry, here, this is the actual ItemPotion class I made for the splash potion. And what I mean by the creative tab is, I have my own creative tab, and whenever I add this to that creative tab, it adds all potions that actually exist in vanilla, to my tab package com.puplet.items; import com.puplet.blocks.PupletBlocks; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; public class InstaPotion extends ItemPotion{ public InstaPotion(){ } public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.drink; } public static boolean isSplash(int par0) { return true; } }
11. *bump*
12. I'm also having a hard time creating the actual potion item itself. When I try to set its creative tab, it adds all the potions to my creative tab
13. *bump*
14. /effect {player} 30 (the Id of my potion)
15. Not working. Not sure if it's because I'm applying the effect via command. If so, how do I create the physical splash potion. Is it just an Item @Override public boolean isInstant() { return true; } public void affectEntity(EntityLivingBase entity1, EntityLivingBase entity2, int par3, double par4){ entity2.setDead(); }
16. Also, I found what you described, understand what it does in vanilla, but still don't know what to do in my case
17. Well yes it was copy in paste, but if you read the question, I was asking if I should use something similar to that code.
18. cannot be taken seriously at all if you produce a thread like this. What does this have to do with basic java. Also, just because I did something wrong, doesn't mean I copy pasted something
19. Still don't know what to do Does it need to be similar to the affectEntity code in the Potion class public void affectEntity(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase, int par3, double par4) { int j; if ((this.id != heal.id || par2EntityLivingBase.isEntityUndead()) && (this.id != harm.id || !par2EntityLivingBase.isEntityUndead())) { if (this.id == harm.id && !par2EntityLivingBase.isEntityUndead() || this.id == heal.id && par2EntityLivingBase.isEntityUndead()) { j = (int)(par4 * (double)(6 << par3) + 0.5D); if (par1EntityLivingBase == null) { par2EntityLivingBase.attackEntityFrom(DamageSource.magic, (float)j); } else { par2EntityLivingBase.attackEntityFrom(DamageSource.causeIndirectMagicDamage(par2EntityLivingBase, par1EntityLivingBase), (float)j); } } } else { j = (int)(par4 * (double)(4 << par3) + 0.5D); par2EntityLivingBase.heal((float)j); } }
20. I assume this is wrong too? @SubscribeEvent public void onEffect(LivingUpdateEvent event){ if (event.entityLiving.isPotionActive(PupletItems.potionInstaKill)){ event.entityLiving.attackEntityFrom(DamageSource.magic, 1.0F); } }
21. I am trying to make a potion that kills a player/entity instantly. I have some code but it doesn't do anything. Any help? @SubscribeEvent public void onPotionThrow(LivingUpdateEvent event){ if (event.entityLiving.isPotionActive(MainClass.instaKill)){ event.entityLiving.setDead(); } }
22. Can someone who knows about terrain gen help?
23. Sorry, posted the wrong error, it's actually on line 264 which says "blockArray[j3 += short1] = Blocks.water;"
24. Nevermind, I got it, but now it's giving me Heres the new code:
25. They are, or they're supposed to be?
×

• #### Activity

×
• Create New...

## Important Information

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