Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Merthew

Members
  • Joined

  • Last visited

Everything posted by Merthew

  1. That didn't work. Caused the code to not even run.
  2. I have created a custom tileentity that on pressing a button in the center, and with all slots empty, it should change the weather to clear. However, nothing happens... Code File: Any help would be apreciated.
  3. I am just going to try to do it a different way, i have been looking at this for way too long and finding nothing. Thanks for your help though.
  4. I don't need to know why the player gets hurt, i know that it is from fall damage. I need to know why the value for fall damage is getting saved somewhere and reintroduced after i try and set it to zero.
  5. I put a sysout statement at the end of the method and it would read 0.0 when the player was either not moving or just moving on the horizontal axis. However, when vertical motion happened it would keep the last value and add to it. That and the player takes fall damage anytime they land if they flew above 3 or 4 blocks.
  6. I have made a custom perk system (somewhat) and one of the things is creative flight. However, when using the creative flight the fall distance is not reset to zero. My guess is it is something to do with me not being smart. Relevant file: PerkHandler,java package merthew.mod.util.handlers; import merthew.mod.capability.perks.IPerks; import merthew.mod.capability.perks.PerksProvider; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.MobEffects; import net.minecraft.potion.PotionEffect; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; public class PerkHandler { @SubscribeEvent public void perkEffects(TickEvent.PlayerTickEvent event) { EntityPlayer player = event.player; IPerks perks = player.getCapability(PerksProvider.PERKS, null); if(perks != null) { //Fly========================================================================================\\ boolean fly = false; if(perks.getPerk("fly") >= 1) { fly = true; event.player.fallDistance = 0.0f; } else { fly = false; } if(fly || event.player.isCreative() || event.player.isSpectator()) { event.player.capabilities.allowFlying = true; event.player.fallDistance = 0.0f; } else { fly = false; event.player.capabilities.allowFlying = false; event.player.capabilities.isFlying = false; } //Strength========================================================================================\\ if(perks.getPerk("strength") > 0) { player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 10, perks.getPerk("strength"), false, false)); } } } }
  7. Fixed it. registration of the capability was deprecated and some of the code was slightly off.
  8. It should be in CapabilityHandler.java
  9. Sorry about that, it should be up now.
  10. I am trying to have a capability that is for detecting if a player is gliding with my custom glider. Currently, i dont think that it is attaching to the player right. Any help would be apreciated. Code: https://github.com/Merthew/Empire-Of-Blood Files: Main.java, Gliding.java, IGliding.java, GlidingProvider.java, GlidingStorage.java, ItemGlider.java, CapabilityHandler.java, GlidingHandler.java
  11. I made a custom glider style thing and i want to change the player model orientation when you are gliding with it, similar to how the elytra works. How would i go about doing this?
  12. This is what i came up with, any thoughts? @SubscribeEvent public void bloodTotem(LivingSpawnEvent event) { World world = event.getWorld(); double range = 32.0; for(int i = 0; i < world.loadedTileEntityList.size(); i ++) { if(world.loadedTileEntityList.get(i) instanceof TileEntityBloodTotem) { BlockPos pos = world.loadedTileEntityList.get(i).getPos(); if(pos.getDistance((int)event.getX(), (int)event.getY(), (int)event.getZ()) <= range) { event.setResult(Result.DENY); } } } }
  13. Not sure if it is the best way, but using onUpdate and checking the stack's slot index may work. May also cause way too much lag...
  14. What would be the best way to stop mobs from spawning around a custom block? Would i use a ticking tileentity or forge events?
  15. Still not working. Getting this from extra utils 2
  16. The problem is that i don't know how to not use static i may just be missing some logic or knowledge of java. *Never mind, i fixed it. sorry for my incompetence
  17. Currently I have two structures that i am trying to generate, but only the one i put in code later generates. Would i need to do them in separate gen classes? Code: https://github.com/Merthew/Empire-Of-Blood Current File: WorldGenCustomStructures
  18. Could not get loot tables to work and managed to fix the issue. Also will fix the string thing, now i just need to get the randomness of the generation to work right.
  19. I currently have two structures that generate. When I started to add loot to the second, holy_altar, it began to crash on world generation. This is the console output that I am getting: I am pretty sure that lag is being caused between ticks and causing the game to crash. What would be a better way to write this code? Code: https://github.com/Merthew/Empire-Of-Blood Current Files: WorldGenStructure, WorldGenCustomStructure
  20. I am getting method not found errors
  21. How would i get other mods to work in the modding environment? Like if i wanted jei or journeymap for testing.
  22. How would I get all the entites within a box around my custom block with a ticking tileentity? I am currently trying this: public class TileEntityBloodCollector extends TileEntity implements ITickable{ private final EobItemHandler itemHandler; int blood; int cap = 10000; public TileEntityBloodCollector() { super(); itemHandler = new EobItemHandler(1); } @Override public void update() { BlockPos pos = this.getPos(); boolean isChanged = false; int ticks = 0; ItemStack stack0 = itemHandler.getStackInSlot(0); if(!this.world.isRemote) { if(stack0.hasTagCompound()) { ItemStack stack = itemHandler.getStackInSlot(2); NBTTagCompound nbt; if (stack.hasTagCompound()) { nbt = stack.getTagCompound(); } else { nbt = new NBTTagCompound(); } if(nbt.hasKey("blood")) { int currBlood = nbt.getInteger("blood"); int possBlood = nbt.getInteger("cap") - currBlood; if(possBlood <= blood) { nbt.setInteger("blood", possBlood + currBlood); blood -= possBlood; } else { nbt.setInteger("blood", blood + currBlood); blood = 0; } stack.setTagCompound(nbt); } isChanged = true; } List<Entity> entitys = this.getWorld().getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(pos.getX()-5, pos.getY()-2, pos.getZ()-5, pos.getX()+5, pos.getY()+2, pos.getZ()+5)); for(Entity e : entitys) { if(!(e instanceof AbstractSkeleton) && !(e instanceof EntitySlime) && !(e instanceof EntityMagmaCube) && (e instanceof EntityCreature) && ticks >= 21) { blood += 10; e.attackEntityFrom(DamageSource.MAGIC, 1); isChanged = true; ticks = 0; } } ticks ++; } if(isChanged) { this.updateTile(); } } @Override public void readFromNBT(NBTTagCompound nbtTagCompound) { super.readFromNBT(nbtTagCompound); itemHandler.deserializeNBT(nbtTagCompound.getCompoundTag("ItemHandler")); this.cap = nbtTagCompound.getInteger("cap"); this.blood = nbtTagCompound.getInteger("blood"); } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound) { super.writeToNBT(nbtTagCompound); nbtTagCompound.setTag("ItemHandler", itemHandler.serializeNBT()); nbtTagCompound.setDouble("cap", cap); nbtTagCompound.setDouble("blood", blood); return nbtTagCompound; } void updateTile(){ world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 3); world.scheduleBlockUpdate(pos,this.getBlockType(),0,0); markDirty(); } public EobItemHandler getItemHandler() { return itemHandler; } @SuppressWarnings("unchecked") @Override public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) itemHandler; } return super.getCapability(capability, facing); } @Override public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) { return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); } @Override public SPacketUpdateTileEntity getUpdatePacket() { return new SPacketUpdateTileEntity(pos, 0, getUpdateTag()); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { readFromNBT(pkt.getNbtCompound()); } @Override public NBTTagCompound getUpdateTag() { return this.writeToNBT(new NBTTagCompound()); } Code: https://github.com/Merthew/Empire-Of-Blood/ Currently working on: BlockBloodCollector

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.