-
[1.18.2] save entities in item nbt
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.
-
[1.18.2] save entities in item nbt
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.
-
[1.18.2] save entities in item nbt
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.
-
[1.18.2] save entities in item nbt
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?
-
[1.18.2] save entities in item nbt
how does one save an entity as item nbt?
-
[1.18.2] Making a slippery block
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
-
[1.18.2] Making a slippery block
it only makes me faster. the actual gradual speeding up and slowing down doesnt happen.
-
[1.18.2] Making a slippery block
where does it set it? i cant find it in the ice block class, the Material class, or in the Blocks class.
-
[1.18.2] Making a slippery block
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.
-
[1.18.2] Making a slippery block
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
its only for the item the block is invisible
-
Forge issue
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
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); } } }
-
1.17.1 change an item texture depending on a value
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
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; }
IPS spam blocked by CleanTalk.