Everything posted by poopoodice
-
Place Block as Player
use raytracing to find the location (player.getLookVec() to get where the player's looking at) of the block that is going to be placed and use world.setBlockState to set the block. BlockItem contains a lot of information you want.
-
Block Place Packets
I think you should be able to simply return null in getStateForPlacement() (in custom block class), and you can get the information you want from there as well, otherwise you can also use EntityPlaceEvent that I don't think you will even need packets depend on what do you want to do.
-
Custom command help
I'm also interested in if the client side only commands works in newer versions, but unfortunately I can't test it now.
-
Draw rectangle on player screen
What I have: @SubscribeEvent public static void onRenderCrosshair(RenderGameOverlayEvent.Pre event) { if (event.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS) { event.setCanceled(true); int screenHeight = event.getWindow().getScaledHeight(); int screenWidth = event.getWindow().getScaledWidth(); minecraft.getTextureManager().bindTexture(REC); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(screenWidth / 2.0D - 1, screenHeight / 2.0D, -90.0D).tex(0.0F, 1.0F).endVertex(); bufferbuilder.pos(screenWidth / 2.0D - 1, screenHeight / - 5, -90.0D).tex(0.0F, 0.0F).endVertex(); bufferbuilder.pos(screenWidth / 2.0D + 30, screenHeight /, -90.0D).tex(1.0F, 1.0F).endVertex(); bufferbuilder.pos(screenWidth / 2.0D + 30, screenHeight / - 5, -90.0D).tex(1.0F, 0.0F).endVertex(); tessellator.draw(); } } What it shows: Any ideas? (the texture is a pure green 16x16 png file)
-
(Solved) 1.14.4 - Filling container slots with items
try return an empty stack in slotClick() and for the "number" transfer
-
Make a mob attack only specific players
If you mean a custom mob, I think you will be able to use goals to decide and target the players with certain condition.
-
Listen to mouse click event? solved
I tried InputEvent.MouseInputEvent and InputEvent.ClickInputEvent and InputEvent.RawMouseEvent they worked fine but they are unable to detect when the user is "holding/pressing" the button. Is it a good idea to check if the button (mouse) is down in client tick event? if so, how do I check it since the org.lwjgl.input.Mouse.isButtonDown(i) no longer exist and I can't find something similar. http://forum.lwjgl.org/index.php?topic=5857.0
-
[1.14.4] Using .containerItem() to leave behind an item with NBT data?
Ah, by that can't you not just use something like @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack result = new ItemStack(something); result.setTag(itemStack.getTag()); return result; } ?
-
[1.14.4] Using .containerItem() to leave behind an item with NBT data?
I remember in vanilla minecraft you can combine two damaged items, which are saved by nbt as well, but I don't know how they work and where they are being done.
-
[1.14.4] Using .containerItem() to leave behind an item with NBT data?
I've never interact with container item before but I think you should be able to get the nbt tag from the old stack and attach it to the new stack?
-
Custom loot_table not read
I remember that when you do your own loot tables you need to add name tag in front of the "rolls" { "type": "minecraft:block", "pools": [ { "name": "a name here", <----------- "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "minecraft:apple" } ] } ] } if you want to have a try with that
-
Best Way to create a bullet
Oops, I meant to type BlockRayTraceResult blockResult for (int i=0;i<10;i++) { blockResult = //split into 10 sections, just an example world.rayTraceBlocks(new RayTraceContext(from.add((to.subtract(from)).mul(0.1D, 0.1D, 0.1D).mul(i, i, i)) , to, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.ANY, this)); if (.......... ..... } but it's just an example, don't think it will work properly without any disadvantages such as cause lags,, etc.
-
Best Way to create a bullet
AxisAlignedBB axisalignedbb = this.getBoundingBox().expand(this.getMotion()).grow(1.0D); Vec3d from = this.getPositionVec(); Vec3d to = this.getPositionVec().add(new Vec3d(this.getMotion().getX(), this.getMotion().getY(), this.getMotion().getZ())); EntityRayTraceResult entityResult = ProjectileHelper.rayTraceEntities(world, this, from, to, axisalignedbb, (entity) entity -> != getThrower()); BlockRayTraceResult blockResult = world.rayTraceBlocks(new RayTraceContext(from, to, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.ANY, this)); as shown above, both entity/block ray trace only gets the first block/entity hit. does doing multiple raytracing such as splitting one raytracing into multiple like BlockRayTraceResult blockResult for (int i=0;i<10;i++) { blockResult = //split into 10 sections, just an example world.rayTraceBlocks(new RayTraceContext(from, from + (to - from) / 10 * i, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.ANY, this)); if (.......... ..... } sounds like a good idea, or it will cause bad performances?
-
Best Way to create a bullet
It has troubled me for a long time, I already made a bullet that can fire correctly, but what I want is that it reduces damages and its range when hit a block/entity instead of just got removed. And currently it extends ThrowableEntity. What I tried to do was to check in onImpact() if the bullet was hitting a block, if true reduces range and damage, but the problem is if the bullet hit both of them at the same time (which can be pretty big since it moves really fast), it only returns the first thing got hit and then it moves to the next position and ignores the other(s) hits. I also try to find every single block between the start vec and destination vec (entity hit), but it will be really terrible if there are lots of bullets in the world doing that at the same time.. any ideas will be appreciated.
-
updating 1.10.2 to 1.12.2 textures and other stuff not working
a repo can be helpful
-
Modifier public not allowed here
just asking isn't itemgroup both sided?
-
Infinity Ingot like glow
I don't think it's actually glowing, it's just item texture animation make it looks like
-
1.15.2 How to make a class for several blocks
true, only 1.12- uses two blocks.
-
1.15.2 How to make a class for several blocks
of course you can, and iirc there are only two slabs blocks (half with upper/lower) and a doubled.
-
[1.15.2] Best way to store strings on the player object.
Capability is normally a better option, you can even store all those values in a single capability.
-
Animated Armour Texture
Item and blocks' textures use .mcmeta, and it does not seem to work on armours. How do I do animated armour textures?
-
[1.15.2] Server not doing anything but no crash nor error
have you accept the eula? (change false to true in eula.txt)
-
errors while modding[RESOLVED]
Post your code
-
[1.15.2] Client command
Maybe Client Chat Event... I'm not so sure.
-
[1.15.2] Client command
You can't atm afaik.
IPS spam blocked by CleanTalk.