grossik
-
Posts
88 -
Joined
-
Last visited
Posts posted by grossik
-
-
Hi
I try to get custom entity to a specific position which is located above the diamond block, but the entity stops next to the block and doesn't continue. Where is the problem? How can I get my entity to position above the diamond block?
Custom goal:
public class TestMoveToPositionGoal extends Goal { protected MiniGolemEntity mob; protected BlockPos blockPos; protected int index; protected int tryTicks; public TestMoveToPositionGoal(MiniGolemEntity entity, int index) { this.mob = entity; this.index = index; this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.JUMP)); blockPos = new BlockPos(8, -60, -19); } @Override public void tick() { super.tick(); if(!blockPos.closerThan(this.mob.position(), 1D)) { this.tryTicks++; if(this.shouldRecalculatePath()) { System.out.println("recalculate"); mob.getNavigation().moveTo(blockPos.getX() + 0.5D, blockPos.getY(), blockPos.getZ() + 0.5D, 1F); } } else { this.tryTicks--; mob.getNavigation().stop(); mob.chanceStatus(index); System.out.println("finish"); } } @Override public void start() { super.start(); tryTicks = 0; } public boolean shouldRecalculatePath() { return this.tryTicks % 40 == 0; } @Override public boolean canUse() { return mob.canUseGoal(index); } }
Entity only recalculate path, but doesn't move. I know. I can solve it by increasing the radius, but I don't want to.
-
11 minutes ago, Draco18s said:
Go look at the Slider class and figure out how it builds the text that is displayed in the render method.
Yeah. I had to change render...
-
Hi. I update my mod from 1.15.2 to 1.16.1 and in 1.16.1 version I see "button" behind my text.
I dont know how this solved
Screen init:
@Override public void func_231160_c_() { super.func_231160_c_(); this.func_230480_a_(new Slider(this.guiLeft + 84, this.guiTop + 26, 85, 10, new StringTextComponent("Red: "), new StringTextComponent(""), 0, 255, this.container.tile.red, false, true, slider -> { })); this.func_230480_a_(new Slider(this.guiLeft + 84, this.guiTop + 38, 85, 10, new StringTextComponent("Green: "), new StringTextComponent(""), 0, 255, this.container.tile.green, false, true, slider -> { })); this.func_230480_a_(new Slider(this.guiLeft + 84, this.guiTop + 50, 85, 10, new StringTextComponent("Blue: "), new StringTextComponent(""), 0, 255, this.container.tile.blue, false, true, slider -> { })); }
-
1 hour ago, TheGreyGhost said:
Please add your blender model i.e. the .blend file...
-TGG
Yeah sorry
-
15 hours ago, TheGreyGhost said:
Howdy
Could you pls put your Blender model and your mod into GitHub? I will take a look in the next couple of days if you like.
-TGG
-
9 hours ago, TheGreyGhost said:
Hi
Probably - some of your face normals are pointing the wrong way. Use blender to automatically recalculate them so that your faces are pointing outwards, not inwards.
Cheers
TGG
I try recalculate outside (Mesh -> Normals -> Recalculate outside) but not work. I also tried to recalculate inside and set from faces but nothing worked.
-
Hi. I create Blender model, But I don't understand why it's hollow?
And JSON is:
{ "parent": "forge:block/default", "loader": "forge:obj", "model": "farmcraft:models/block/boiling.obj", "flip-v": true, "transform": { "scale": [0.375, 0.375, 0.375], "translation": [0.4, -0.5, 0.4] } }
This problem occurs when they start to change model in modeling tab in blender. And if I add a normal cube without changes so it works.
-
Hi. I need to use more texture layers for my item, but only 5 layers will load.
Minecraft minecraft = Minecraft.getInstance(); ItemColors colors = minecraft.getItemColors(); colors.register((p_210242_0_, p_210242_1_) -> { if(p_210242_0_.getItem() == ItemInit.LABEL.get()) { return ((LabelItem) p_210242_0_.getItem()).getColor(p_210242_0_, p_210242_1_); } return -1; }, ItemInit.LABEL.get());
Item json:
{ "parent": "item/generated", "textures": { "layer0": "realistic_beer_brewing:items/label/layer0", "layer1": "realistic_beer_brewing:items/label/layer1", "layer2": "realistic_beer_brewing:items/label/layer2", "layer3": "realistic_beer_brewing:items/label/layer3", "layer4": "realistic_beer_brewing:items/label/layer4", "layer5": "realistic_beer_brewing:items/label/layer5", "layer6": "realistic_beer_brewing:items/label/layer6", "layer7": "realistic_beer_brewing:items/label/layer7", "layer8": "realistic_beer_brewing:items/label/layer8" } }
Is the number of layers limited or why doesn't it work for me?
-
Nobody knows?
-
Hello.
I have transferStackInSlot method and use hasRecipe for find if itemstack is present in recipe.
@Override public ItemStack transferStackInSlot(PlayerEntity 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 == 2) { if(!this.mergeItemStack(itemstack1, 3, 39, true)) { return ItemStack.EMPTY; } slot.onSlotChange(itemstack1, itemstack); } else if(index != 1 && index != 0) { if(this.hasRecipe(itemstack1)) { if(!this.mergeItemStack(itemstack1, 1, 2, false)) { return ItemStack.EMPTY; } } else if(this.isBucket(itemstack1)) { if(!this.mergeItemStack(itemstack1, 0, 1, false)) { return ItemStack.EMPTY; } } else if(index >= 3 && index < 30) { if(!this.mergeItemStack(itemstack1, 30, 39, false)) { return ItemStack.EMPTY; } } else if(index >= 30 && index < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return ItemStack.EMPTY; } } else if(!this.mergeItemStack(itemstack1, 3, 39, false)) { return ItemStack.EMPTY; } if(itemstack1.isEmpty()) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if(itemstack1.getCount() == itemstack.getCount()) { return ItemStack.EMPTY; } slot.onTake(playerIn, itemstack1); } return itemstack; } protected boolean hasRecipe(ItemStack stack) { return this.world.getRecipeManager().getRecipe(MaltingRecipe.RECIPE_TYPE, new Inventory(stack), world).isPresent(); }
But hasRecipe return false for all itemstack, but i have recipe who works.
Recipe:
{ "type": "realistic_beer_brewing:malting", "ingredient": { "item": "realistic_beer_brewing:barley" }, "result": { "item": "realistic_beer_brewing:barley_seed" }, "process_time": 200 }
Recipe in this tile entity works.
-
17 hours ago, lisilew said:
TestStructures se nikde v projektu nepoužívá.
Vidím, že zaregistrujete svůj JigsawPiece pod VillagerInit # init .
Zdá se, že jste přidali PlainsVillagePools.init (); .
Opravil váš problém a podařilo se vám přidat struktury do vanilských vesnic?
Oh... sorry
Yes. If you use VillagerInit#init then it will work for you.
-
11 hours ago, lisilew said:
I am also trying to add structures to vanilla villages.
If you succeeded, could you please share how you achieved it?
-
3 minutes ago, TheGreyGhost said:
Hi
I think it's better to split your obj file into 8 separate files.
If you really want to load just a small part of one obj file, have a look at OBJLoader and OBJmodel to see how it parses the file (g and o in particular); you can copy it to your own loader class and tweak it if you want to.
TGG
I wanted it over json, but ok...
Any good way to split a model? Or will I have to do it for each file separately?
-
16 hours ago, TheGreyGhost said:
Howdy
A couple of things
- it looks like you have multiple faces one on top of the other which is leading to 'z-fighting', https://en.wikipedia.org/wiki/Z-fighting
- the 'recommended' version of forge has a bug where the vertex order of faces in obj files doesn't match what vanilla expects for ambient occlusion and leads to strange lighting. Try latest instead of recommended.
-TGG
I use 1.15.2-31.1.63 forge version
And the problem was that this obj files is too large and render for all 8 blocks...
Can I change the start position from which it will be loading obj model?
-
-
17 hours ago, diesieben07 said:
What?
Sorry. I solved this problem. I had rotationPitch and rotationYaw from Entity class not PlayerEntity...
Thank you for everything.
-
2 hours ago, diesieben07 said:
First you are copying the position wrong (do not use getPosition, it returns a BlockPos). Use getPosX, getPosY and getPosZ.
Then you also need to copy the other properties of the entity. Most importantly motion (Entity#getMotion) and for ItemEntity properties like pickupDelay, age, etc.
float f8 = MathHelper.sin(location.rotationPitch * ((float)Math.PI / 180F)); float f2 = MathHelper.cos(location.rotationPitch * ((float)Math.PI / 180F)); float f3 = MathHelper.sin(location.rotationYaw * ((float)Math.PI / 180F)); float f4 = MathHelper.cos(location.rotationYaw * ((float)Math.PI / 180F)); float f5 = ((float)Math.PI * 2F); float f6 = 0.02F; itementity.setMotion((double)(-f3 * f2 * 0.3F) + Math.cos((double)f5) * (double)f6, (double)(-f8 * 0.3F + 0.1F * 0.1F), (double)(f4 * f2 * 0.3F) + Math.sin((double)f5) * (double)f6);
This code drop item around player no in front of the player. Its from PlayerEntity drop
-
Thank you. I have new problem... The position where item entity spawn is bad I need player position and if I drop item I'll take it back to inventory. (therefore onCollideWithPlayer is empty), and item entity not move like default item entity
-
30 minutes ago, diesieben07 said:
You are creating your custom entity without setting its location. The location defaults to 0, 0, 0, which is in the void and the item immediately dies.
I update constructor with position. And I update github ass well. But render still not work
-
12 minutes ago, diesieben07 said:
At this point I can't see the issue from just staring at the code.
Please post a Git repository showing the issue so I can test this locally.
Item for this entity
-
1 minute ago, diesieben07 said:
This is your issue. You need to use your own registry name.
Yes I know. I forgot send new registration. Sorry
public static RegistryObject<EntityType<FarmCraftItemEntity>> ITEM_ENTITY = ENTITIES .register("item_farmcraft", () -> EntityType.Builder.<FarmCraftItemEntity>create(FarmCraftItemEntity::new, EntityClassification.MISC) .size(0.25F, 0.25F) .build(new ResourceLocation(Main.MOD_ID, "item_farmcraft").toString()));
-
1 minute ago, diesieben07 said:
Post where you spawn the entity.
This item:
package cz.grossik.farmcraft.item; import cz.grossik.farmcraft.entity.FarmCraftItemEntity; import cz.grossik.farmcraft.init.EntityInit; import net.minecraft.entity.Entity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemBarley extends Item { public ItemBarley(Properties properties) { super(properties); } @Override public boolean hasCustomEntity(ItemStack itemstack) { return true; } @Override public Entity createEntity(World world, Entity location, ItemStack itemstack) { return new FarmCraftItemEntity(EntityInit.ITEM_ENTITY.get(), world); } }
-
package cz.grossik.farmcraft.entity; import cz.grossik.farmcraft.init.ItemInit; import net.minecraft.entity.EntityType; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.network.IPacket; import net.minecraft.world.World; import net.minecraftforge.fml.network.NetworkHooks; public class FarmCraftItemEntity extends ItemEntity { public FarmCraftItemEntity(EntityType<? extends ItemEntity> p_i50217_1_, World p_i50217_2_) { super(p_i50217_1_, p_i50217_2_); } @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @Override public void tick() { System.err.println("tick"); if(this.isInWater()) { System.err.println("water"); ItemStack newItemStack = new ItemStack(ItemInit.soaked_barley.get()); ItemEntity newItem = new ItemEntity(this.world, this.getPosition().getX(), this.getPosition().getY(), this.getPosition().getZ(), newItemStack); this.world.addEntity(newItem); this.remove(); } super.tick(); } }
-
Just now, diesieben07 said:
Okay.
But still doesnt work
[1.19] Custom head rendering problem
in Modder Support
Posted · Edited by grossik
Hi.
I'm having trouble rendering my own head. If I place a head that has my skin texture and another one next to it (without texture - completely black) my skin is visible on the second one until the first head disappears from view.
How to make the second head always be all black?
https://imgur.com/Bd2fNgP
https://imgur.com/m04kAWV
Code: