Jump to content

fcelon

Members
  • Posts

    115
  • Joined

  • Last visited

Everything posted by fcelon

  1. You have to rotate it in the gui in such a way, that it will look 2D. The model itself is always the same.
  2. You can change position in which an item is rendered based on it which slot is it and whether it is viewed in first person or thidr preson. That's it. JSON can't determine if player has a different model. By the way, why do you want to change player model?
  3. Hello, I recently read an article on minecraft website about scrpiting API for bedrock being in public beta. As a java player I have no idea how it works and what can be achieved with it. Does anyone here know something more about the API and it's possibilities and limits? Could it combined with addons become something like Forge? I also wonder what it means for Minecraft modding. Do you thing coders will move from java to bedrock where they can make money from their creations? Thanks for sharing your opinions.
  4. Forge adds attack reach attribute. You can change player attack reach using attribute modifiers.
  5. If you are new to modding, you probably shouldn't make a pull request. Also, what is the reason you don't want to use curse of binding? You can change item description, so there won't be any information about it. If it is an item made by you, you can even prevent it from glowing if course of binding is the only enchantment, so the player won't notice anything.
  6. Thanks you, but I have already created a new workspace.
  7. Hello, I am unable to update forge version in my workspace. I found on this forum, that I just have to change version parameter in minecraft section of build.gradle and retun commands to create workspce. I changed my version parameter to recommanded forge version (1.12.2-14.23.5.2768) and ran gradlew setUpDecompWorkspace and gradlew eclipse commands in my workspace directory. Everythung looked fine, but when I opened eclipse, refreshed my project and started the game, I noticed that the forge version did not change. I tried to do it once more and this time set my version parameter to latest (1.12.2-14.23.5.2772), but with the same result. Any possible reason why I canont update forge in my worksapce? Thaks for help
  8. Any entity. Max health entity attribute is capped at 1024 (unless forge changes it).
  9. Hello, I wonder if there is any way to make fishing hook pull hooked entity to player upon retraction (It already does pull them a little, but I want to make the pull much stronger). I need to get the hooked entity and increase it's velocity when the rod is retracted. The problem is, that ItemFishedEvent only trigger when an item is fished (as the name suggests). Thakns for any help.
  10. I have already tried setting it to true. It has no effect.
  11. In minecraft forge, each loot table pool needs to have a name, otherwise the loot table won't work. This is because forge allows to add and remove pools, so it needs some way to refer to them. Adding "name":"whatever" to your loot table pool should work. Look at https://mcforge.readthedocs.io/en/latest/items/loot_tables/ for more info.
  12. Hello My block renders well, but it doesn't display cracking animation when being mined. I tried to look to other block, that are not full cubes and have cracking animation, but I was unable to find what is my block missing. How can I enable the cracking animation? My block class: Thanks for any help
  13. The container works as intended in other gamemodes. But in spectator mode game crashes as soon as it is opened. Tile entity class: package com.fcelon.enhancedcraft.tileentities; import com.fcelon.enhancedcraft.Main; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.Container; import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntityLockable; import net.minecraft.util.NonNullList; public class TileEntityBookshelf extends TileEntityLockable { public boolean hasBook1; public boolean hasBook2; public boolean hasBook3; public boolean hasBook4; public boolean hasBook5; public boolean hasBook6; private String customName; private NonNullList<ItemStack> BookshelfItemStacks = NonNullList.<ItemStack>withSize(6, ItemStack.EMPTY); @Override public int getSizeInventory() { return BookshelfItemStacks.size(); } @Override public boolean isEmpty() { for (ItemStack itemstack : this.BookshelfItemStacks) { if (!itemstack.isEmpty()) { return false; } } return true; } public int getBookCount() { int i = 0; for (ItemStack itemstack : this.BookshelfItemStacks) { if (!itemstack.isEmpty()) { i++; } } return i; } @Override public ItemStack getStackInSlot(int index) { return index >= 0 && index < this.BookshelfItemStacks.size() ? (ItemStack)this.BookshelfItemStacks.get(index) : ItemStack.EMPTY; } public ItemStack decrStackSize(int index, int count) { return ItemStackHelper.getAndSplit(this.BookshelfItemStacks, index, count); } /** * Removes a stack from the given slot and returns it. */ public ItemStack removeStackFromSlot(int index) { ItemStack stack = ItemStackHelper.getAndRemove(this.BookshelfItemStacks, index); IBlockState state = world.getBlockState(pos); world.notifyBlockUpdate(pos, state, state, 3); return stack; } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int index, ItemStack stack) { if (index >= 0 && index < this.BookshelfItemStacks.size()) { this.BookshelfItemStacks.set(index, stack); IBlockState state = world.getBlockState(pos); world.notifyBlockUpdate(pos, state, state, 3); } } @Override public int getInventoryStackLimit() { return 1; } @Override public boolean isUsableByPlayer(EntityPlayer player) { if (this.world.getTileEntity(this.pos) != this) { return false; } else { return player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D; } } @Override public void openInventory(EntityPlayer player) { } @Override public void closeInventory(EntityPlayer player) { } @Override public boolean isItemValidForSlot(int index, ItemStack stack) { if (stack.getItem() == Items.BOOK || stack.getItem() == Items.ENCHANTED_BOOK || stack.getItem() == Items.WRITABLE_BOOK || stack.getItem() == Items.WRITTEN_BOOK) { return true; } return false; } @Override public int getField(int id) { return 0; } @Override public void setField(int id, int value) { } @Override public int getFieldCount() { return 0; } @Override public void clear() { BookshelfItemStacks.clear(); } @Override public String getName() { return this.hasCustomName() ? this.customName : "modcontainer.bookshelf"; } @Override public boolean hasCustomName() { return this.customName != null && !this.customName.isEmpty(); } @Override public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { // TODO Auto-generated method stub return null; } @Override public String getGuiID() { return Main.MOD_ID + ":bookshelf"; } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); ItemStackHelper.saveAllItems(compound, this.BookshelfItemStacks); if (this.hasCustomName()) { compound.setString("CustomName", this.customName); } return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); ItemStackHelper.loadAllItems(compound, this.BookshelfItemStacks); if (compound.hasKey("CustomName", 8)) { this.customName = compound.getString("CustomName"); } } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { NBTTagCompound compound = pkt.getNbtCompound(); System.out.println("recieving"); readUpdateTag(compound); } @Override public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound compound = new NBTTagCompound(); this.writeUpdateTag(compound); System.out.println("sending"); return new SPacketUpdateTileEntity(pos, getBlockMetadata(), compound); } @Override public NBTTagCompound getUpdateTag() { NBTTagCompound compound = super.getUpdateTag(); writeUpdateTag(compound); return compound; } public void readUpdateTag (NBTTagCompound compound) { int j = compound.getInteger("hasBooks"); System.out.println(j); this.hasBook1 = ((j & 1) == 1); this.hasBook2 = (((j >> 1) & 1) == 1); this.hasBook3 = (((j >> 2) & 1) == 1); this.hasBook4 = (((j >> 3) & 1) == 1); this.hasBook5 = (((j >> 4) & 1) == 1); this.hasBook6 = (((j >> 5) & 1) == 1); } public void writeUpdateTag (NBTTagCompound compound) { int j = 0; for (int i = 0; i < this.getSizeInventory(); i++) { if (!this.getStackInSlot(i).isEmpty()) { j += 1 << i; } } System.out.println(j); compound.setInteger("hasBooks", j); } } Container class: ackage com.fcelon.enhancedcraft; import com.fcelon.enhancedcraft.tileentities.TileEntityBookshelf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerBookshelf extends Container{ public TileEntityBookshelf bookshelfInventory; public ContainerBookshelf(IInventory playerInventory, TileEntityBookshelf bookshelfInventory) { this.bookshelfInventory = bookshelfInventory; for (int i = 0; i < bookshelfInventory.getSizeInventory(); i++) { this.addSlotToContainer(new Slot(bookshelfInventory, i, 34 + i * 18, 20) { public boolean isItemValid(net.minecraft.item.ItemStack stack) { return bookshelfInventory.isItemValidForSlot(0, stack); } } ); } for (int l = 0; l < 3; ++l) { for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new Slot(playerInventory, k + l * 9 + 9, 8 + k * 18, l * 18 + 51)); } } for (int i1 = 0; i1 < 9; ++i1) { this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 109)); } } public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.inventorySlots.get(index); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (index < this.bookshelfInventory.getSizeInventory()) { if (!this.mergeItemStack(itemstack1, this.bookshelfInventory.getSizeInventory(), this.inventorySlots.size(), true)) { return ItemStack.EMPTY; } } else if (!this.mergeItemStack(itemstack1, 0, this.bookshelfInventory.getSizeInventory(), false)) { return ItemStack.EMPTY; } if (itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } } return itemstack; } @Override public boolean canInteractWith(EntityPlayer playerIn) { // TODO Auto-generated method stub return bookshelfInventory.isUsableByPlayer(playerIn); } } Thanks for any help
  14. Hello, I want to create a mod, that will add better bookshelves to minecraft. Those will be empty when crafted and player will be able to store books in them. Putting enchanted books into bookshelves around an enchanting table will increase the chance of getting corresponding enchantment upon using it. However, it is going to be a little bit tricky. I wonder if there is a way to change vanilla enchanting method to be able to tweak enchantemnt probabilities. If not, I can stop vanilla enchanting table GUI from appearing and instead open my own when player clicks at an enchanting table. This GUI would look similar to vanilla GUI, but would use my own enchanting method. Do you think it is a good idea?
  15. Hello, I would like to improve creepers a little by giving them ability to blow up obstacles in their path. I siplmy want them t blow up if there are some blocks in the way preventing them from reaching the player. However, I don't know how to detect that. Thanks for any help.
  16. Hello, I have created tile enitty with GUI and button. When player presses the button, message is sent to server informing it, that the tile entity should start crafting. However, how can the server know, which tile entity is the player interracting with? Is there any way to get this information? There isn't anythng like tile entity ID player could send to server to inform it. I can use coordinates to specify the tile, but it's not good idea. The number is too big and might reffer unloaded chunk. Another solution would be a raytrace result (player has to look at the tile entity to start the interraction), but that's not ideal solution either. Is there any better way? Thanks for any help.
  17. Hello, I have created my own entity and allowed players to leash animals to it. However, it looks wierd, can I somehow change the point from which the lead starts to make it look right? Thanks for any help
  18. Thanks you. I am developing my mod for 1.12, but since alot of people is stil playing older versions of the game, I want to support them as well.
  19. Hello, when I run my mod in Eclipse, everything is fine, but when I build it and run it in regular launcher, all item models are missing. Any possible explanations? Thanks for any help.
  20. Hello, does anyone know what is the difference between InventoryBasic and Container class. I have created an entity, which can equip custom gear (like a horse). Which of those two classes shoulb I extend to allow it to store those items and create GUI for it's owner, so he can manage it's equipment? Thanks for any help.
  21. Thanks for help, just one morequestion. Is there any software for creating entity models? (Something like MrCrayfish's Model Creator, but for entities)
  22. Hello, Is there any way, how can I bind different textures to different boxes of my entity model? Right now, all of my boxes have exactly the same texture and I want them to look different. I looked on vanilla entity textures and it looks like textures for all the boxes are in a single texture (file) and minecraft somehow magicaly manages to put the right parts of it on the right boxes. But for my entity this doesn't work. Model: import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBallista extends ModelBase { private final ModelRenderer partA; private final ModelRenderer partB; public ModelBallista() { partA = new ModelRenderer(this); partB = new ModelRenderer(this); partA.addBox(-2, 0, -2, 4, 17, 4);//support partB.addBox(-3, 0, -22, 6, 2, 44);//main part partB.addBox(-3, 0, -23, 2, 5, 1); partB.addBox(1, 0, -23, 2, 5, 1); partB.addBox(-1, 2, -23, 2, 2, 40);//bolt partB.addBox(3, 2, -22, 8, 2, 1); partB.addBox(-11, 2, -22, 8, 2, 1); partB.addBox(11, 2, -21, 6, 2, 1); partB.addBox(-17, 2, -21, 6, 2, 1); partB.addBox(17, 2, -20, 5, 2, 1); partB.addBox(-22, 2, -20, 5, 2, 1); partB.addBox(-22, 3, -19, 44, 0, 37);//string this.partB.setRotationPoint(0, 16, 0); } @Override public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) { this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entityIn); this.partA.render(scale); this.partB.render(scale); } @Override public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) { this.partB.rotateAngleX = -0.017453292F * headPitch; this.partB.rotateAngleY = 0.017453292F * (180 - netHeadYaw); super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn); } } Renderer: import com.mujmajnkraft.bettersurvival.Reference; import com.mujmajnkraft.bettersurvival.client.model.ModelBallista; import com.mujmajnkraft.bettersurvival.entities.siegeweapons.EntityBallista; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; public class RenderBallista extends Render<EntityBallista>{ //private static final ResourceLocation BALLISTA_TEXTURES = new ResourceLocation(Reference.MOD_ID+":textures/entity/minecart.png"); protected ModelBase model = new ModelBallista(); public RenderBallista(RenderManager renderManager) { super(renderManager); } @Override public void doRender(EntityBallista entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); this.bindEntityTexture(entity); this.model.render(entity, 0.0F, 0.0F, -0.1F, entity.rotationYaw, entity.rotationPitch, 0.0625F); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } @Override protected ResourceLocation getEntityTexture(EntityBallista entity) { return new ResourceLocation(Reference.MOD_ID + ":textures/entities/ballista.png"); } } Thanks for any help.
×
×
  • Create New...

Important Information

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