Jump to content

Eastonium

Members
  • Posts

    151
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    https://minecraft.curseforge.com/projects/nuicraft
  • Personal Text
    We do what we must because we can

Recent Profile Visitors

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

Eastonium's Achievements

Creeper Killer

Creeper Killer (4/8)

1

Reputation

  1. Another very related question: How do I get it to send the data when a player needs to get its first update? Right now it appears empty when I initially open the world until I change the contents of the tank.
  2. Thank you! I think this is just what I needed!
  3. I'm trying to create a generic tank that can hold any fluid, and has that fluid rendered on the block, as well as in the GUI. My current step in getting all of that to work is finding out how to properly send fluid updates to the client. I know packets have to be used for this is some way, but I've seen multiple ways of doing it. Here are the ways I've seen: Using the getDataPacket() and onDataPacket() functions (in your tile entity), but I haven't seen how/where those are supposed to be triggered. Using a custom packet using your mod's own packet handler. (I don't yet know how to use packets like this, and haven't seen a clean example of it.) So, how is the best way to do this?
  4. I've tried everything you suggested, but still no luck. Nothing has changed. My updated code will be on my initial post. EDIT: I have also found that if you make another mob ride this entity, kill the entity (not the mob) and relog, the mob disappears. This happens in creative mode as well. Is it possible it is trying to kill everything that is riding my entity? EDIT AGAIN: I found the source of the problem. It wasn't my entity (although it did have some other issues as jabelar pointed out). The issue is that I was cancelling the event when you tried to dismount this entity. However, I was not checking if me entity was dead when you tried to dismount. This, when trying to kill my entity, it would try to dismount everything, get stopped, and mess up everything.
  5. I'm currently trying to make an entity that you can hit while riding. However, when you give this entity enough damage to kill it, it is dying server-side but not client side. Another peculiarity is that this issue does not occur if you're in creative mode, and if you switch to creative mode while riding the entity when should be dead, it will die and you'll dismount. I've done some debugging and have found that the damage update from the final blow to the entity is not getting sent to the client, but any damage updates before that are. This is confirmed to happen with both attacking player damage and damage from lava. I'll keep looking into this issue, but if someone knows what might be causing this, or how other rideable entities accomplish this, please let me know! EDIT: Current Entity Code public class EntityFreezeIce extends Entity { private static final DataParameter<Float> HEALTH = EntityDataManager.<Float>createKey(EntityFreezeIce.class, DataSerializers.FLOAT); public EntityFreezeIce(World worldIn) { super(worldIn); this.preventEntitySpawning = true; this.setSize(0.7F, 1.5F); } public EntityFreezeIce(World worldIn, Entity entityIn) { this(worldIn); this.setPosition(entityIn.posX, entityIn.posY, entityIn.posZ); this.setRotation(entityIn.rotationYaw, 0.0F); this.motionX = entityIn.motionX; this.motionY = entityIn.motionY; this.motionZ = entityIn.motionZ; this.setDamage(7.0F); entityIn.startRiding(this, true); } @Override protected void entityInit() { this.dataManager.register(HEALTH, Float.valueOf(0.0F)); } public void setDamage(float damage) { this.dataManager.set(HEALTH, Float.valueOf(damage)); } public float getDamage() { return ((Float)this.dataManager.get(HEALTH)).floatValue(); } @Nullable @Override public AxisAlignedBB getCollisionBox(Entity entityIn) { return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null; } @Nullable @Override public AxisAlignedBB getCollisionBoundingBox() { return this.getEntityBoundingBox(); } @Override public boolean canBePushed() { return false; } @Override public boolean canBeCollidedWith() { return !this.isDead; } @Override public boolean canRiderInteract() { return !this.isDead; } @Override public double getMountedYOffset() { return 0.0D; } @Override public boolean attackEntityFrom(DamageSource source, float amount) { NuiCraft.logger.log(Level.INFO, world.isRemote + " " + this.isDead + " " + this.getDamage()); if (!this.world.isRemote && !this.isDead) { if (this.isEntityInvulnerable(source)) { return false; } else { this.setBeenAttacked(); this.setDamage(this.getDamage() - amount); boolean fromCreativePlayer = source.getTrueSource() instanceof EntityPlayer && ((EntityPlayer)source.getTrueSource()).capabilities.isCreativeMode; if (/*fromCreativePlayer || */this.getDamage() <= 0.0F) { this.setDead(); } NuiCraft.logger.log(Level.INFO, world.isRemote + " " + this.isDead + " " + this.getDamage()); return true; } } else { return true; } } @Override protected void readEntityFromNBT(NBTTagCompound compound) { this.setDamage(compound.getFloat("health")); } @Override protected void writeEntityToNBT(NBTTagCompound compound) { compound.setFloat("health", this.getDamage()); } } SOLUTION: I was cancelling the dismount event for this entity, but did not include a check to see if this entity was dead. Solved by only cancelling the dismount event if my entity was still alive.
  6. First, I believe "recipes" is correct, as that is what I am using currently. Either that or both "recipe" and "recipes" works? I just tested what you have here, and can confirm that my test recipe (basically identical) also did not load, and did not error either. You're not crazy! I have a similar recipe that uses a shaped ore recipe that works though, so try changing the recipe type to "forge:ore_shaped". If it works, I'm guessing you might have another problem: the recipe book will try to place the items in like "xxx", "x--", "---". If it does, there are a couple problems with forge that need to be fixed.
  7. Finally, someone replied! When are you getting the infinite loop? (hopper-pull, shift-click...) Also, I made my modifications to the mergeItemStack() function when I came across problems while shift-clicking, and I tested it and it worked fine for me. How is shift-clicking not working for you? I'm determined to get this added to forge (hopefully) now that I know others wish this were a thing.
  8. Is there a way to override the texture for a filled universal bucket of a new fluid? Currently you're not given many options when you call FluidRegistry.addBucketForFluid() If this isn't doable right now, I think it might make a good feature.
  9. I was more or less hoping he had the same problem I have and that if not I could compare my code to his if he got his working. Which more or less (I say that a lot) worked, my problem was also in my blockstates file, on the same line even. I had misspelled the name of my liquid after "fluid": Thanks for your reply
  10. I have the exact same problem, hopefully someone will help us soon.
  11. I recently added a slot to a container I had, and overrided the getSlotStackLimit() function. However, when I shift-clicked items from my inventory, the value I set in getSlotStackLimit() was completely ignored. I ended up having to override the mergeItemStack() function in my container class to account for the slot stack limit. I think this would be a good thing to change for all instances however, and given forge already changes the mergeItemStack() function to make sure that the item (to put in) is valid for the slot, I don't see why this shouldn't be added. Here's the new version of the function that I came up with: //Changed to be sensitive to Slot stack limits @Override protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection){ boolean flag = false; int i = startIndex; if (reverseDirection) i = endIndex - 1; if (stack.isStackable()){ while (stack.stackSize > 0 && (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex)){ Slot slot = (Slot)this.inventorySlots.get(i); ItemStack itemstack = slot.getStack(); int maxLimit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit()); if (itemstack != null && areItemStacksEqual(stack, itemstack)){ int j = itemstack.stackSize + stack.stackSize; if (j <= maxLimit){ stack.stackSize = 0; itemstack.stackSize = j; slot.onSlotChanged(); flag = true; }else if (itemstack.stackSize < maxLimit){ stack.stackSize -= maxLimit - itemstack.stackSize; itemstack.stackSize = maxLimit; slot.onSlotChanged(); flag = true; } } if (reverseDirection){ --i; }else ++i; } } if (stack.stackSize > 0){ if (reverseDirection){ i = endIndex - 1; }else i = startIndex; while (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex){ Slot slot1 = (Slot)this.inventorySlots.get(i); ItemStack itemstack1 = slot1.getStack(); if (itemstack1 == null && slot1.isItemValid(stack)){ // Forge: Make sure to respect isItemValid in the slot. if(stack.stackSize <= slot1.getSlotStackLimit()){ slot1.putStack(stack.copy()); slot1.onSlotChanged(); stack.stackSize = 0; flag = true; break; }else{ itemstack1 = stack.copy(); stack.stackSize -= slot1.getSlotStackLimit(); itemstack1.stackSize = slot1.getSlotStackLimit(); slot1.putStack(itemstack1); slot1.onSlotChanged(); flag = true; } } if (reverseDirection){ --i; }else ++i; } } return flag; } I'm not currently using 4 spaces or the other formatting stuff, but I can change that if need be.
  12. I've been updating my mod from 1.8.8 to 1.10.2 the last couple days (boy, is it easy compared to most updates), but I've come across multiple instances where I'm either using or overriding deprecated functions. For example: using GameRegistry.registerBlock(...) using GameRegistry.registerItem(...) overriding Item.getItem(...) overriding Block.isFullCube(...) **https://github.com/Eastonium/Nuicraft** I know that I should update the GameRegsitry.registerBlock/Item(...) ones, but should I worry about the ones i'm overriding? Also, despite the deprecated functions, my mod works 100% as far as I have tested. Thank you in advance for your help
  13. ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(Bionicle.Bamboo), 0, new ModelResourceLocation("bionicle:Bamboo", "inventory")); Well, thanks! I thought I had tried this before, but I guess not the right way.
  14. So, I have a block with the textures registered like this: ModelLoader.setCustomStateMapper(Bionicle.BambooBlock, (new StateMap.Builder()).ignore(new IProperty[] {BlockBamboo.AGE}).build()); How do I change/define the item model for that block?
  15. I'm not asking to be able to enchant items in the enchantment table. I'm asking how I could have what the MC Wiki calls "secondary items". I have an item that I would like to be able to use Efficency and Fortune, but nothing else. Is there some way to do this?
×
×
  • Create New...

Important Information

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