Jump to content

Simon_kungen

Members
  • Posts

    151
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Sweden
  • Personal Text
    If you can read this; you can read.

Recent Profile Visitors

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

Simon_kungen's Achievements

Creeper Killer

Creeper Killer (4/8)

3

Reputation

  1. Hi I'm not talking about a crafting handler for example a machine, a crafting handler for the vanilla crafting system (should work for modded crafting tables that uses Mojang's crafting handler). And using Json formatting will not work as my idea will be working with NBT of items. And if I would use Json with a unique item for each operation I would end up with at the minimum 2432902008176640000 different items and recipes, not ideal. Let's say I want a handler (as an example) for when I place a Shulker Box together with any ItemStack in the crafting window: The resulting Shulker Box will be the ItemStack in the Shulker Box without having to place it down and putting it manually. It will take the whole stack at once and a total of eight other other items could be done at once. If it doesn't fit, or partly fits it will not take the ItemStack from the Crafting Window or will put in as much as possible and subtract that from the remaining ItemStack. That was just an example of what I want to do as Shulker Boxes can be crafted with dyes which would break that system, but hopefully the idea got through.
  2. Umm, how does your recipe look like? Is there a reason it needs to be mirror selective? In real life most things doesn't care whenever its mirrored or not, only the weak force care as far as we've discovered.
  3. I could really need some help with this, it just doesn't make sense to me.
  4. My initial thought was to look at how the End Portal was rendered because it is invisible from the bottom, but that only confused me more. In EndPortalTileEntityRenderer.java it has a bunch of if statements for the different directions which is compared to a final variable in EndPortalTileEntity.java for Direction.UP: EndPortalTileEntity.java ... @OnlyIn(Dist.CLIENT) public boolean shouldRenderFace(Direction face) { return face == Direction.UP; } EndPortalTileEntityRenderer.java ... if (tileEntityIn.shouldRenderFace(Direction.SOUTH)) { bufferbuilder.pos(x, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); bufferbuilder.pos(x + 1.0D, y, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); bufferbuilder.pos(x + 1.0D, y + 1.0D, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); bufferbuilder.pos(x, y + 1.0D, z + 1.0D).color(f3, f4, f5, 1.0F).endVertex(); } if (tileEntityIn.shouldRenderFace(Direction.NORTH)) { bufferbuilder.pos(x, y + 1.0D, z).color(f3, f4, f5, 1.0F).endVertex(); bufferbuilder.pos(x + 1.0D, y + 1.0D, z).color(f3, f4, f5, 1.0F).endVertex(); bufferbuilder.pos(x + 1.0D, y, z).color(f3, f4, f5, 1.0F).endVertex(); bufferbuilder.pos(x, y, z).color(f3, f4, f5, 1.0F).endVertex(); } ... When doing the same it just stops it from rendering altogether for that plate, so I have no idea what's going on here. The only difference is that I use a numerical value contrary to an object in a switch statement: CableCaseTileEntityRenderer.java private void renderPlate(T te, byte plate, String texture, BufferBuilder buffer) { TextureAtlasSprite sprite = Minecraft.getInstance().getTextureMap().getAtlasSprite(texture); float u1 = sprite.getMinU(), v1 = sprite.getMinV(), u2 = sprite.getMaxU(), v2 = sprite.getMaxV(); final float[] c = te.getPlate(plate) instanceof ItemElement ? UtilBlocks.toFractal(Util.hex2rgb(((ItemElement) te.getPlate(plate)).getTint()),255) : new float[] {1,1,1}; int combined, lma, lmb; switch (plate) { case 3: // South combined = getWorld().getCombinedLight(te.getPos().south(),0); lma = combined >> 16 & 65535; lmb = combined & 65535; buffer.pos(min,min,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u2,v1).lightmap(lma,lmb).endVertex(); buffer.pos(min,max,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u2,v2).lightmap(lma,lmb).endVertex(); buffer.pos(max,max,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u1,v2).lightmap(lma,lmb).endVertex(); buffer.pos(max,min,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u1,v1).lightmap(lma,lmb).endVertex(); break; case 0: // West combined = getWorld().getCombinedLight(te.getPos().west(),0); lma = combined >> 16 & 65535; lmb = combined & 65535; buffer.pos(minZ,min,min).color(c[0],c[1],c[2],ALPHA).tex(u2,v1).lightmap(lma,lmb).endVertex(); buffer.pos(minZ,max,min).color(c[0],c[1],c[2],ALPHA).tex(u2,v2).lightmap(lma,lmb).endVertex(); buffer.pos(minZ,max,max).color(c[0],c[1],c[2],ALPHA).tex(u1,v2).lightmap(lma,lmb).endVertex(); buffer.pos(minZ,min,max).color(c[0],c[1],c[2],ALPHA).tex(u1,v1).lightmap(lma,lmb).endVertex(); ...
  5. Hi As seen from this video the applied texture (coloured walls) is on both sides, I don't want that. How would I go about making so the texture is only on the outer side? My idea was to give the "plates" depth by adding a second plate on the inside too but reversed, so I only need to texture two of the four sides of a plate (make it slightly more efficient). Later I also plan on making the plates transparent at times such as when holding a tool, and if I have all sides textured it would end up looking wonky with double layers both being transparent. Current code (for rendering South plate): TextureAtlasSprite sprite = Minecraft.getInstance().getTextureMap().getAtlasSprite(texture); float u1 = sprite.getMinU(), v1 = sprite.getMinV(), u2 = sprite.getMaxU(), v2 = sprite.getMaxV(); combined = getWorld().getCombinedLight(te.getPos().south(),0); lma = combined >> 16 & 65535; lmb = combined & 65535; buffer.pos(min,min,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u2,v1).lightmap(lma,lmb).endVertex(); buffer.pos(min,max,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u2,v2).lightmap(lma,lmb).endVertex(); buffer.pos(max,max,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u1,v2).lightmap(lma,lmb).endVertex(); buffer.pos(max,min,maxZ).color(c[0],c[1],c[2],ALPHA).tex(u1,v1).lightmap(lma,lmb).endVertex();
  6. Hmm, alright. My plan is for other mods to use their crowbar for my blocks. Railcraft is a good example who adds a crowbar, hopefully, it's in the right place from the get-go.
  7. Hi Tags are great, but I can't find a proper tag list for common modded tag names. Example: I have my own wrench and crowbars and I have my blocks use the tag where my tools are listed, but until now I have just guessed what other modders are most likely going to use: forge/tags/items/crowbars.json { "replace": false, "values": [ "intercraftcore:white_crowbar", "intercraftcore:orange_crowbar", "intercraftcore:magenta_crowbar", "intercraftcore:light_blue_crowbar", "intercraftcore:yellow_crowbar", "intercraftcore:lime_crowbar", "intercraftcore:pink_crowbar", "intercraftcore:gray_crowbar", "intercraftcore:light_gray_crowbar", "intercraftcore:cyan_crowbar", "intercraftcore:purple_crowbar", "intercraftcore:blue_crowbar", "intercraftcore:brown_crowbar", "intercraftcore:green_crowbar", "intercraftcore:red_crowbar", "intercraftcore:black_crowbar" ] } forge/tags/items/wrenches.json { "replace": false, "values": [ "intercraftcore:wrench" ] } Is there a webpage for common tag names? Modded tools like crowbars and wrenches are not part of vanilla and therefore is not on Forge's Github like forge/tags/items/ingots/iron tag or expected modded ingots like forge/tags/items/ingots/copper tag.
  8. So there is no way of doing it without a TileEntity?
  9. Hi What I want is not a TileEntitySpecialRender, but a renderer for my block. A TileEntity is overkill and would only result in unnecessary lag as it will be used as a building block, a special render on the client for my block would suffice. My question is how I would go about that in 1.14, from creating a rendering class and attaching it to the client to tell it to render this on my block. This cannot be done with JSON files as far as I can tell. This render needs to be dynamic with animations and such, a lighting bolt coming off of it from time to time for example.
  10. Umm, looks like you've done exactly as I did. Can you only attach it when you register an item and initializes it in the same line? LARGE_GLASS_JAR = new ItemSingleStackGlassContainer(new Item.Properties().setTEISR(() -> () -> SingleStackGlassContainerItemRender.INSTANCE),"large_glass_jar",0.01f); I register my items by creating a static variable and then add that variable to a list that registers all the entries when filled.
  11. Alright, added this: @Nullable @Override public CompoundNBT getShareTag(ItemStack stack) { IItemHandler handler = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(NullPointerException::new); CompoundNBT nbt = new CompoundNBT(); nbt.putInt("Slot",0); handler.getStackInSlot(0).write(nbt); return nbt; } @Override public void readShareTag(ItemStack stack, @Nullable CompoundNBT nbt) { ItemStack readStack = ItemStack.read(nbt); IItemHandler handler = stack.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).orElseThrow(NullPointerException::new); ((IItemHandlerModifiable) handler).setStackInSlot(0,readStack); } Not sure if I should go after a certain standard or if the NBT can be made however I want, but the problem is that none of these fire. The debugger does not break when marking both of them to suspend.
  12. So yeah... looks like none of my questions has been answered lately. Should I give up on capabilities for now?
  13. Hi My item has ItemHandler capability, which works fine. But one of the things I have when storing a item on the capability is overring the translation key with the contained stack's translation key. The problem is that this will only sync when opening the item again. I need to send a message to the client with the new contained stack which I do not know how to do. I don't know which ItemStack I need to change on the client when the container is closed. My item needs to have two capabilities attached to it. One is the Forge ItemHandler Capability while the other that is exclusive to the glass variant should be able to store a liquid too. For this, I made a provider that includes these capabilities: public class StackFluidContainerProvider implements ICapabilitySerializable { private final FluidContainer fluid; private final ItemStackHandler inventory; private final LazyOptional<IItemHandler> itemHandler = LazyOptional.of(this::getInventory); private final LazyOptional<IFluidContainer> fluidHandler = LazyOptional.of(this::getFluid); public StackFluidContainerProvider(short slots, short maxVolume) { inventory = new ItemStackHandler(slots); fluid = new FluidContainer(maxVolume); } protected FluidContainer getFluid() { return fluid; } protected ItemStackHandler getInventory() { return inventory; } @SuppressWarnings("ConstantConditions") @Override public INBT serializeNBT() { CompoundNBT compoundNBT = new CompoundNBT(); compoundNBT.put("items", CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.getStorage().writeNBT(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY,getInventory(),null)); compoundNBT.put("fluid", FluidContainerStorage.FLUID_CONTAINER_CAPABILITY.getStorage().writeNBT(FluidContainerStorage.FLUID_CONTAINER_CAPABILITY,getFluid(),null)); return compoundNBT; } @Override public void deserializeNBT(INBT nbt) { if (nbt instanceof CompoundNBT) { CompoundNBT compoundNBT = (CompoundNBT)nbt; CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.getStorage().readNBT(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, getInventory(), null, compoundNBT.get("items")); FluidContainerStorage.FLUID_CONTAINER_CAPABILITY.getStorage().readNBT(FluidContainerStorage.FLUID_CONTAINER_CAPABILITY, getFluid(), null, compoundNBT.get("fluid")); } } @SuppressWarnings("unchecked") public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) { if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return itemHandler.cast(); else if (cap == FluidContainerStorage.FLUID_CONTAINER_CAPABILITY) return fluidHandler.cast(); return (LazyOptional<T>) LazyOptional.empty(); } } But when I try and fetch the capability the parameter cap seems to always be null, which means it always returns the first statement (in this case the ItemHandler) which results in a casting error.
  14. Other mods I can find add their TEISR directly in the item constructor (which crashes the server). But doing the same I at least expect it to do something while in Single Player.
  15. Hmm... nothing seems to be happening here. Is there some vanilla items that use TEISR I can look at? I can't find any which implies TEISR is a Forge addition to the game and not native to vanilla Minecraft.
×
×
  • Create New...

Important Information

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