-
Posts
128 -
Joined
-
Last visited
Everything posted by Merthew
-
That didn't work. Caused the code to not even run.
-
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.
-
[1.12.2] Creative flight in survival not resetting fall distance
Merthew replied to Merthew's topic in Modder Support
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. -
[1.12.2] Creative flight in survival not resetting fall distance
Merthew replied to Merthew's topic in Modder Support
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. -
[1.12.2] Creative flight in survival not resetting fall distance
Merthew replied to Merthew's topic in Modder Support
Still not able to get it working. -
[1.12.2] Creative flight in survival not resetting fall distance
Merthew replied to Merthew's topic in Modder Support
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. -
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)); } } } }
-
Fixed it. registration of the capability was deprecated and some of the code was slightly off.
-
It should be in CapabilityHandler.java
-
Sorry about that, it should be up now.
-
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
-
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?
-
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); } } } }
-
[SOLVED] onItemStoppedBeingHeld event with ItemStack parameter?
Merthew replied to hiotewdew's topic in Modder Support
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... -
What would be the best way to stop mobs from spawning around a custom block? Would i use a ticking tileentity or forge events?
-
Still not working. Getting this from extra utils 2
-
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
-
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
-
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.
-
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
-
I am getting method not found errors
-
How would i get other mods to work in the modding environment? Like if i wanted jei or journeymap for testing.
-
Thanks
-
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