ElTotisPro50
Members-
Posts
266 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ElTotisPro50
-
(1.16.5 MCP) my tileentity cant load the items when i exit
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
instead of private final LazyOptional<IItemHandler> handler = LazyOptional.of(() -> itemHandler); i used private net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandlerModifiable> handler; (because i need a handler) im not using anymore IItemHandler because im using IInventory but is not working either -
(1.16.5 MCP) my tileentity cant load the items when i exit
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
what? im not using IInventory -
(1.16.5 MCP) my tileentity cant load the items when i exit
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
public class MyTileentity extends LockableLootTileEntity { private final ItemStackHandler itemHandler = createHandler(); private NonNullList<ItemStack> items = NonNullList.withSize(1,ItemStack.EMPTY); private final LazyOptional<IItemHandler> handler = LazyOptional.of(() -> itemHandler); public PipeTile(TileEntityType<?> tileEntityTypeIn) { super(tileEntityTypeIn); } @Override protected NonNullList<ItemStack> getItems() { return this.items; } @Override protected void setItems(NonNullList<ItemStack> itemsIn) { this.items = itemsIn; } public PipeTile() { this(ModTileEntities.MY_TILEENTITY.get()); } @Override public void read(BlockState state, CompoundNBT nbt) { super.read(state, nbt); this.items = NonNullList.withSize(this.getSizeInventory(),ItemStack.EMPTY); if(!this.checkLootAndRead(nbt)) { ItemStackHelper.loadAllItems(nbt,this.items); } } @Override public CompoundNBT write(CompoundNBT compound) { super.write(compound); if(!this.checkLootAndWrite(compound)) { ItemStackHelper.saveAllItems(compound,this.items); } return compound; } @Override protected ITextComponent getDefaultName() { return null; } @Override protected Container createMenu(int id, PlayerInventory player) { return null; } private ItemStackHandler createHandler() { return new ItemStackHandler(2) { @Override protected void onContentsChanged(int slot) { markDirty(); } @Override public int getSlotLimit(int slot) { return 1; } @Nonnull @Override public ItemStack insertItem(int slot, @Nonnull ItemStack stack, boolean simulate) { if(!isItemValid(slot, stack)) { return stack; } return super.insertItem(slot, stack, simulate); } }; } public ItemStack getItemSlot0() { return this.itemHandler.getStackInSlot(0); } @Nonnull @Override public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) { if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return handler.cast(); } return super.getCapability(cap, side); } @Override public int getSizeInventory() { return 1; } } well yeah those methods are called -
i had this problem since 3 months but i tried to look minecraft classes and other mods but i didnt success, my tileentity works fine about everything except loading and saving the items when I exit the game or even only the world, im using exactly the same methods that the chest have(read and write) but is not working MY TILE ENTITY ONLY HAS 1 SLOT private NonNullList<ItemStack> items = NonNullList.withSize(1,ItemStack.EMPTY); @Override public void read(BlockState state, CompoundNBT nbt) { super.read(state, nbt); this.items = NonNullList.withSize(this.getSizeInventory(),ItemStack.EMPTY); if(!this.checkLootAndRead(nbt)) { ItemStackHelper.loadAllItems(nbt,this.items); } } @Override public CompoundNBT write(CompoundNBT compound) { super.write(compound); if(!this.checkLootAndWrite(compound)) { ItemStackHelper.saveAllItems(compound,this.items); } return compound; }
-
i tried 3 things and none of them worked, all throwed a nullPointerException when the game is about to start private static ITextComponent ab1 = ModKeys.mykey.func_238171_j_(); private static String mykeyAssignedKey = ab1.getString(); AND private static ITextComponent ab1 = ModKeys.ability1Key.func_238171_j_(); private static String ability1AssignedKey = ab1.toString(); AND private static String mykeyAssignedKey = ModKeys.mykey.func_238171_j_().getString();
-
for example i have a test item and if i look an entity and right click the item it should elimitate the entity but entity.remove() or entity.setDead() just make the entity invisible, even i can hear it (i tried to remove the entity with !world.isremote and without it but it didnt work) @Override public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand handIn) { double raytraceDistance = 5.0D; RayTraceResult entityResult = Minecraft.getInstance().objectMouseOver; if(entityResult.getType() == RayTraceResult.Type.ENTITY) { Entity lookPos = ((EntityRayTraceResult) entityResult).getEntity(); if(lookPos.getEntity() instanceof ArmorStandEntity || lookPos.getEntity() instanceof PaintingEntity || lookPos.getEntity() instanceof ItemEntity || lookPos.getEntity() instanceof PlayerEntity) {} //this makes that it doesnt work for this entities else { if(!world.isRemote) { lookPos.setDead(); // or lookpos.remove() } } } return super.onItemRightClick(world, player, handIn); }
-
im making some things with my keys and i want to show a text overlay(i found how) to show witch key do certain thing
-
i made this: String test = ModKeys.mkey.getTranslationKey() and it it suposed to give me the key i assigned to that keybind(in this case X) but it gives me key.mymod.x and i dont want all the information(my key has a lang name), and i tried the other methods like getKeyModifier(), getKeyDescription(), getDefault(), etc but none of them works
-
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
FINALLY IT WORKED :))))))))))), so in what contexts i cant initialize the player with minecraft.instance.player? -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
i didnt mean "without instantiate player class", i meant where do i get the player class without "PlayerEntity player = new PlayerEntity()", Minecraft's class can give me the player (i know basic java even if it sometimes doesnt look like it) -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
the if(Minecraft.getInstance().player == null) is because else it gives me a null exception and i have to get the player from minecraft class or else where do i get it(without instantiating it) didnt work the game thinks im cheating like if you are in a server and you turn on noclip hacks @SubscribeEvent public static void test(LivingEvent.LivingUpdateEvent event) { if(Minecraft.getInstance().player == null) return; PlayerEntity player = Minecraft.getInstance().player; if(event.getEntityLiving() instanceof PlayerEntity) { player.noClip = true; } } -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
1-Can you help me with a post i made about rendering a glowing line? (the line is following my head movements but not from the eyes and if dont look to the north the line doesnt follow my head) 2-the code you asked @SubscribeEvent public static void test(LivingEvent.LivingUpdateEvent event) { if(Minecraft.getInstance().player == null) return; PlayerEntity player = Minecraft.getInstance().player; if(event.getEntityLiving() == player) { //OR if(event.getEntity() == player) { player.noClip = true; } } -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
nope didnt work, i saw some people asking for noclip and it worked for them, why is not working for me? (also luis are you "good" with rendering?) -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
noclip should never be set to true?? but thats how it works you set the boolean to true, and with debugger you mean run the game in debug mode and when i export my mod it should work fine? -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
diesieben and you are telling me 2 different things :/, what i have to do? -
(1.16.5 MCP) turn on the noclip is not working
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
@SubscribeEvent public static void test(LivingEvent.LivingUpdateEvent event) { if(Minecraft.getInstance().player == null) return; PlayerEntity player = Minecraft.getInstance().player; if(event.getEntityLiving() instanceof PlayerEntity) { player.noClip = true; } } didnt work -
i want to use world.playsound but make that it doesnt play the sound multiple times(if i hold rightclick a custom item im running my instruction multiple times, or i hold a custom keybind and play sound too) because im holding a key or click im calling an instruction a lot and it will play the sound multiple times, i want to make it kind of like a mod called "STUPID THINGS MOD" like the item "worlds smallest violine", i looked the code but i didnt find where that part was https://www.youtube.com/watch?v=diyfHzzQrZA MINUTE 8:10
-
why dont you know(i mean you dont guess all) but i thought is a simple error
-
well can you help me with a problem i posted? (Redundant texture list for particle mymod:myparticle)
-
diesieben help me with this i cant get to a solution, if i remove the 3 GLStateManagers the line doesnt show
-
i know i already asked for this but i spend a lot of time trying to fix my line but i just cant, without GLStateManager.translate and rotate the line doesnt draw (i tried to render the line in PlayerRenderEvent.Pre JUST IN CASE IT WOULD WORK but is the same) sorry for posting in the wrong forum but i dont know where to post my posts TotisRenderHelper public static void setupRenderLightning() { GlStateManager.pushMatrix(); GlStateManager.disableTexture(); GlStateManager.disableLighting(); GlStateManager.disableCull(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_ALPHA); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F);; } public static void finishRenderLightning() { GlStateManager.enableLighting(); GlStateManager.enableTexture(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } public static void drawGlowingLine(Vector3d start, Vector3d end, float thickness, Color color) { drawGlowingLine(start, end, thickness, color,1F); } public static void drawGlowingLine(Vector3d start, Vector3d end, float thickness, Color color, float alpha) { if(start == null || end == null) return; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bb = tessellator.getBuffer(); int smoothFactor = Minecraft.getInstance().gameSettings.ambientOcclusionStatus.ordinal(); int layers = 10 + smoothFactor * 20; GlStateManager.pushMatrix(); start = start.scale(-1D); end = end.scale(-1D); GlStateManager.translated(-start.x,-start.y,-start.z); start = end.subtract(start); end = end.subtract(end); { double x = end.x - start.x; double y = end.y - start.y; double z = end.z - start.z; double diff = MathHelper.sqrt(x * x + z * z); float yaw = (float) (Math.atan2(z, x) * 180.0D / 3.141592653589793D) - 90.0F; float pitch = (float) -(Math.atan2(y, diff) * 180.0D / 3.141592653589793D); GlStateManager.rotatef(-yaw, 0.0F, 1.0F, 0.0F); GlStateManager.rotatef(pitch, 1.0F, 0.0F, 0.0F); } for (int layer = 0; layer <= layers; ++layer) { if(layer < layers) { GlStateManager.color4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1.0F / layers / 2); GlStateManager.depthMask(false); } else { GlStateManager.color4f(1.0F, 1.0F, 1.0F, alpha); GlStateManager.depthMask(true); } double size = thickness + (layer < layers ? layer * (1.25D / layers) : 0.0D); double d = (layer < layers ? 1.0D - layer * (1.0D / layers) : 0.0D) * 0.1D; double width = 0.0625D * size; double height = 0.0625D * size; double length = start.distanceTo(end) + d; bb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); bb.pos(-width, height, length).endVertex(); bb.pos(width, height, length).endVertex(); bb.pos(width, height, -d).endVertex(); bb.pos(-width, height, -d).endVertex(); bb.pos(width, -height, -d).endVertex(); bb.pos(width, -height, length).endVertex(); bb.pos(-width, -height, length).endVertex(); bb.pos(-width, -height, -d).endVertex(); bb.pos(-width, -height, -d).endVertex(); bb.pos(-width, -height, length).endVertex(); bb.pos(-width, height, length).endVertex(); bb.pos(-width, height, -d).endVertex(); bb.pos(width, height, length).endVertex(); bb.pos(width, -height, length).endVertex(); bb.pos(width, -height, -d).endVertex(); bb.pos(width, height, -d).endVertex(); bb.pos(width, -height, length).endVertex(); bb.pos(width, height, length).endVertex(); bb.pos(-width, height, length).endVertex(); bb.pos(-width, -height, length).endVertex(); bb.pos(width, -height, -d).endVertex(); bb.pos(width, height, -d).endVertex(); bb.pos(-width, height, -d).endVertex(); bb.pos(-width, -height, -d).endVertex(); tessellator.draw(); } GlStateManager.popMatrix(); } } ModEvents @SubscribeEvent public static void onRenderWorld(RenderWorldLastEvent event) { PlayerEntity player = Minecraft.getInstance().player; if(Minecraft.getInstance().player == null) return; if(ModKeys.mykey.isKeyDown()) { double distance = player.getPositionVec().add(0,player.getEyeHeight(),1).distanceTo(Minecraft.getInstance().objectMouseOver.getHitVec()); TotisRenderHelper.setupRenderLightning(); //This is supposed to control the rotation and scale GlStateManager.translatef(0.5f, player.getEyeHeight() - 1, 0.5f); GlStateManager.rotatef(-player.rotationYawHead, 0, 1, 0); GlStateManager.rotatef(player.rotationPitch, 1, 0, 0); { Vector3d start = new Vector3d(0.1F, 0, 1); Vector3d end = start.add(0, 0, distance); //this will end where the player is looking TotisRenderHelper.drawGlowingLine(start,end,0.5F, Color.MAGENTA); } TotisRenderHelper.finishRenderLightning(); return; } }
-
Should'nt the .render method render at least the chest(now that i canceled .Pre im invisible but why my chest is not rendering if im using that method)? @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Pre event) { PlayerEntity player = event.getPlayer(); event.setCanceled(true); } @SubscribeEvent public static void onRenderPlayer(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel(); ModelRenderer chestBody = model.bipedBody; for(int i = 0; i < 10; i++) { GlStateManager.pushMatrix(); GlStateManager.translatef((rand.nextFloat() - 0.5f) / 15,0,(rand.nextFloat() - 0.5f) / 15); GlStateManager.color4f(1,1,1,0.3F); GlStateManager.enableBlend(); Minecraft.getInstance().getRenderManager().textureManager.bindTexture(((AbstractClientPlayerEntity)player).getLocationSkin()); chestBody.render( event.getMatrixStack(), event.getBuffers().getBuffer(RenderType.getEntitySolid(((AbstractClientPlayerEntity)player).getLocationSkin())), Minecraft.getInstance().getRenderManager().getPackedLight(player, 1f), OverlayTexture.NO_OVERLAY); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } }
-
what? so appart of the eyes, what i need for the effect for the player? you said i cant use renderplayerevent for that because there is no solution for the body duplicate
-
you said that i need another layer for the player for my flickering effect, what does that have in common with cancel the playe rendering?
-
what i have to put here: Map<String, PlayerRenderer> skinMap = Minecraft.getInstance().getRenderManager().getSkinMap(); PlayerRenderer render; render = skinMap.get("default"); render.addLayer(new EndermanEyesLayer<LivingEntity>(WHAT I HAVE TO PUT HERE); and how i do it for the player body(my flickering effect)