
KaboomRoads
Members-
Posts
42 -
Joined
-
Last visited
Everything posted by KaboomRoads
-
i found what seems to be the problem, but cant find the thing causing it. its this check right here that stops the code after from running; if (!compoundtag.contains("thingsandstuff.entities")) return; so the compound tag doesnt contain "thingsandstuff.entities" event though im setting the tag in the method saveEntity.
-
so i just changed some things like you said, and this is what i have right now: public static void saveEntity(ItemStack stack, Entity entity) { if (stack == null) return; CompoundTag compoundtag = stack.getOrCreateTag(); if (!compoundtag.contains("thingsandstuff.entities")) { compoundtag.put("thingsandstuff.entities", new ListTag()); } ListTag listtag = compoundtag.getList("thingsandstuff.entities", 10); listtag.add(entity.saveWithoutId(compoundtag)); compoundtag.put("thingsandstuff.entities", listtag); stack.setTag(compoundtag); entity.remove(Entity.RemovalReason.DISCARDED); } public static void releaseEntities(ItemStack stack, Vec3 pos, Level level) { if (stack == null) return; CompoundTag compoundtag = stack.getOrCreateTag(); if (!compoundtag.contains("thingsandstuff.entities")) return; ListTag listtag = compoundtag.getList("thingsandstuff.entities", Tag.TAG_COMPOUND); Stream<Entity> entities = EntityType.loadEntitiesRecursive(listtag, level); entities.forEach((e) -> { e.teleportTo(pos.x, pos.y, pos.z); level.addFreshEntity(e); }); compoundtag.put("thingsandstuff.entities", new ListTag()); stack.setTag(compoundtag); } it still doesnt spawn the entities though. i dont really understand what you meant by it not compiling, it works fine for me.
-
this is how i save the entities now: CompoundTag compoundtag = stack.getOrCreateTag(); if (!compoundtag.contains("thingsandstuff.entities")) { compoundtag.put("thingsandstuff.entities", new ListTag()); } ListTag listtag = compoundtag.getList("thingsandstuff.entities", 10); listtag.add(entity.saveWithoutId(compoundtag)); compoundtag.put("thingsandstuff.entities", listtag); stack.setTag(compoundtag); entity.remove(Entity.RemovalReason.DISCARDED); this is how i spawn them: CompoundTag compoundtag = stack.getOrCreateTag(); if (!compoundtag.contains("thingsandstuff.entities")) return; ListTag listtag = compoundtag.getList("thingsandstuff.entities", 10); Stream<Entity> entities = EntityType.loadEntitiesRecursive(listtag, level); entities.forEach((e) -> e.setPos(pos)); compoundtag.put("thingsandstuff.entities", new ListTag()); stack.setTag(compoundtag); it still doesnt seem to work.
-
ok so i use this to save the entity: ListTag listtag = compoundtag.getList("thingsandstuff.entities", 0); listtag.add(entity.saveWithoutId(compoundtag)); compoundtag.put("thingsandstuff.entities", listtag); stack.setTag(compoundtag); entity.remove(Entity.RemovalReason.DISCARDED); but how do i get the entity from the tag?
-
how does one save an entity as item nbt?
-
after BlockBehaviour.Properties.of(Material.STONE, MaterialColor.STONE) i added .friction(0.98f), thats what the ice block does when registered. it just speeds me up when walking on it
-
it only makes me faster. the actual gradual speeding up and slowing down doesnt happen.
-
where does it set it? i cant find it in the ice block class, the Material class, or in the Blocks class.
-
the friction seems to just speed me up or slow me down, i think its something to do with the ICE and ICE_SOLID materials, but i have been looking for ages and still cant find how they actually affect slipperiness.
-
how can i make a block slippery like the slipperiness value in 1.12 in 1.18?
-
1.17.1 change an item texture depending on a value
KaboomRoads replied to KaboomRoads's topic in Modder Support
its only for the item the block is invisible -
youre running java 7 but 1.16.5 needs a minimum of java 8 and can run until java 16
-
1.17.1 change an item texture depending on a value
KaboomRoads replied to KaboomRoads's topic in Modder Support
i also found a class called LightPredicate but i dont know how to do something like that package net.minecraft.advancements.critereon; import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.GsonHelper; public class LightPredicate { public static final LightPredicate ANY = new LightPredicate(MinMaxBounds.Ints.ANY); private final MinMaxBounds.Ints composite; LightPredicate(MinMaxBounds.Ints pComposite) { this.composite = pComposite; } public boolean matches(ServerLevel pLevel, BlockPos pPos) { if (this == ANY) { return true; } else if (!pLevel.isLoaded(pPos)) { return false; } else { return this.composite.matches(pLevel.getMaxLocalRawBrightness(pPos)); } } public JsonElement serializeToJson() { if (this == ANY) { return JsonNull.INSTANCE; } else { JsonObject jsonobject = new JsonObject(); jsonobject.add("light", this.composite.serializeToJson()); return jsonobject; } } public static LightPredicate fromJson(@Nullable JsonElement pJson) { if (pJson != null && !pJson.isJsonNull()) { JsonObject jsonobject = GsonHelper.convertToJsonObject(pJson, "light"); MinMaxBounds.Ints minmaxbounds$ints = MinMaxBounds.Ints.fromJson(jsonobject.get("light")); return new LightPredicate(minmaxbounds$ints); } else { return ANY; } } public static class Builder { private MinMaxBounds.Ints composite = MinMaxBounds.Ints.ANY; public static LightPredicate.Builder light() { return new LightPredicate.Builder(); } public LightPredicate.Builder setComposite(MinMaxBounds.Ints pComposite) { this.composite = pComposite; return this; } public LightPredicate build() { return new LightPredicate(this.composite); } } } -
i have a block that is very similar to the light block, i need the texture to change depending on the light level the block has i already have the light block thing functional but the only problem is changing the texture. this is the main json for the item. { "parent": "item/generated", "textures": { "layer0": "mrmod:item/darkness" }, "overrides": [ { "predicate": { "level": 0.0000 }, "model": "mrmod:item/darkness_00" }, { "predicate": { "level": 0.0625 }, "model": "mrmod:item/darkness_01" }, { "predicate": { "level": 0.1250 }, "model": "mrmod:item/darkness_02" }, { "predicate": { "level": 0.1875 }, "model": "mrmod:item/darkness_03" }, { "predicate": { "level": 0.2500 }, "model": "mrmod:item/darkness_04" }, { "predicate": { "level": 0.3125 }, "model": "mrmod:item/darkness_05" }, { "predicate": { "level": 0.3750 }, "model": "mrmod:item/darkness_06" }, { "predicate": { "level": 0.4375 }, "model": "mrmod:item/darkness_07" }, { "predicate": { "level": 0.5000 }, "model": "mrmod:item/darkness_08" }, { "predicate": { "level": 0.5625 }, "model": "mrmod:item/darkness_09" }, { "predicate": { "level": 0.6250 }, "model": "mrmod:item/darkness_10" }, { "predicate": { "level": 0.6875 }, "model": "mrmod:item/darkness_11" }, { "predicate": { "level": 0.7500 }, "model": "mrmod:item/darkness_12" }, { "predicate": { "level": 0.8125 }, "model": "mrmod:item/darkness_13" }, { "predicate": { "level": 0.8750 }, "model": "mrmod:item/darkness_14" }, { "predicate": { "level": 0.9375 }, "model": "mrmod:item/darkness_15" }, { "predicate": { "level": -0.0625 }, "model": "mrmod:item/darkness_01" }, { "predicate": { "level": -0.1250 }, "model": "mrmod:item/darkness_02" }, { "predicate": { "level": -0.1875 }, "model": "mrmod:item/darkness_03" }, { "predicate": { "level": -0.2500 }, "model": "mrmod:item/darkness_04" }, { "predicate": { "level": -0.3125 }, "model": "mrmod:item/darkness_05" }, { "predicate": { "level": -0.3750 }, "model": "mrmod:item/darkness_06" }, { "predicate": { "level": -0.4375 }, "model": "mrmod:item/darkness_07" }, { "predicate": { "level": -0.5000 }, "model": "mrmod:item/darkness_08" }, { "predicate": { "level": -0.5625 }, "model": "mrmod:item/darkness_09" }, { "predicate": { "level": -0.6250 }, "model": "mrmod:item/darkness_10" }, { "predicate": { "level": -0.6875 }, "model": "mrmod:item/darkness_11" }, { "predicate": { "level": -0.7500 }, "model": "mrmod:item/darkness_12" }, { "predicate": { "level": -0.8125 }, "model": "mrmod:item/darkness_13" }, { "predicate": { "level": -0.8750 }, "model": "mrmod:item/darkness_14" }, { "predicate": { "level": -0.9375 }, "model": "mrmod:item/darkness_15" } ] } i think the problem is getting the predicate to work
-
1.17.1 how can i make a block always light level 15
KaboomRoads replied to KaboomRoads's topic in Modder Support
i fixed it now. there was a different never boolean somewhere in the blocks class private static Boolean never(BlockState p_50779_, BlockGetter p_50780_, BlockPos p_50781_, EntityType<?> p_50782_) { return (boolean) false; } -
1.17.1 how can i make a block always light level 15
KaboomRoads replied to KaboomRoads's topic in Modder Support
i only need isValidSpawn isRedstoneConductor isSuffocating isViewBlocking i already did the lightLevel but its not working -
1.17.1 how can i make a block always light level 15
KaboomRoads replied to KaboomRoads's topic in Modder Support
it does i copied it from the blocks class private static boolean never(BlockState p_50806_, BlockGetter p_50807_, BlockPos p_50808_) { return false; } and then i changed Blocks::never to ModBlocks::never -
1.17.1 how can i make a block always light level 15
KaboomRoads replied to KaboomRoads's topic in Modder Support
by my own class i mean my custom blocks class where i register all my blocks the problem is that Blocks cannot be resolved when i put Blocks::never into the params of the methods -
1.17.1 how can i make a block always light level 15
KaboomRoads replied to KaboomRoads's topic in Modder Support
lightLevel truns the block into a light source. i realized that having the light level at 15 would not look great for what i need, i found out that .isValidSpawn(Blocks::never).isRedstoneConductor(Blocks::never).isSuffocating(Blocks::never).isViewBlocking(Blocks::never)) gives the block behavior similar to glass which is what my block is supposed to be like but the methods listed above dont seem to work in my own class -
I have a custom block that i want always to be lit up and ignore all lighting. How can i do that?
-
i tried looking through most of the existing block classes and also model json files and i cant find anything that solves this problem there
-
the only thing i could do so far is change the voxel shape to a slab shape or anything that isnt a full block but then the block outline is smaller and i need it to be a full block shape as long as the block shape is a full block it occludes everything but if its only a full block side on one side it doesnt
-
how can i only cull one particular face when my block is next to another block in this case i want only the top of the block below my block to be cullable and by that i mean i only want the bottom of my block to occlude i want it to occlude similarly to slabs my block culls the faces that are next to a block fine but if its next to itself it doesnt work because it has noOcclusion also because it has noOcclusion it doesnt occlude the block beneath it but if i remove noOcclusion it culls all faces next to it causing xray the voxel shape causes this but i need the foxel shape to stay the same so that the block outline is a full block but the block collision is a half block
-
i have 2 voxel shapes but only getShape affects the occlusion. i need it to stay a full 16 by 16 by 16 cube though but that makes it occlude every side @Override public VoxelShape getShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return SHAPE; } @Override public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) { return COLLISION_SHAPE; }
-
how can i make a block only cull the face of the block below it instead of either culling all faces or no faces similarly to the culling an enchanting table but i cant find anything in the existing classes