From ab2c60db79001234ab566b51a90a828cf956b7bf Mon Sep 17 00:00:00 2001 From: TGGamesYT Date: Fri, 27 Feb 2026 18:29:17 +0100 Subject: [PATCH] some cleanup, 3d modeling stuff and terrorist plane fixes --- gradle.properties | 2 +- .../dev/tggamesyt/szar/client/SzarClient.java | 11 ++ .../client/ThirdpersonModelRegisterer.java | 26 ++++ .../szar/client/mixin/ItemRendererMixin.java | 55 ++++++++ src/client/resources/szar.client.mixins.json | 7 +- .../dev/tggamesyt/szar/IslamTerrorist.java | 45 +++++-- .../java/dev/tggamesyt/szar/PlaneEntity.java | 59 ++++++++- src/main/java/dev/tggamesyt/szar/Szar.java | 67 ++++++---- .../java/dev/tggamesyt/szar/SzarSpawnEgg.java | 120 ++++++++++++++++++ .../resources/assets/szar/lang/en_us.json | 4 +- .../assets/szar/models/item/fasz.json | 5 +- .../assets/szar/models/item/fasz_in_hand.json | 3 + .../assets/szar/models/item/plane.json | 6 + .../assets/szar/models/item/weed_joint.json | 34 +---- .../szar/models/item/weed_joint_in_hand.json | 23 ++++ .../assets/szar/models/item/wheel.json | 6 + .../profession/drog_dealer.png | Bin 0 -> 1235 bytes .../assets/szar/textures/item/fasz.png | Bin 0 -> 632 bytes .../assets/szar/textures/item/plane.png | Bin 0 -> 1229 bytes .../assets/szar/textures/item/wheel.png | Bin 0 -> 574 bytes .../resources/data/szar/recipes/baiter.json | 5 +- src/main/resources/data/szar/recipes/efn.json | 14 ++ .../resources/data/szar/recipes/latex.json | 12 +- .../resources/data/szar/recipes/plane.json | 19 +++ .../resources/data/szar/recipes/wheel.json | 16 +++ 25 files changed, 456 insertions(+), 83 deletions(-) create mode 100644 src/client/java/dev/tggamesyt/szar/client/ThirdpersonModelRegisterer.java create mode 100644 src/client/java/dev/tggamesyt/szar/client/mixin/ItemRendererMixin.java create mode 100644 src/main/java/dev/tggamesyt/szar/SzarSpawnEgg.java create mode 100644 src/main/resources/assets/szar/models/item/fasz_in_hand.json create mode 100644 src/main/resources/assets/szar/models/item/plane.json create mode 100644 src/main/resources/assets/szar/models/item/weed_joint_in_hand.json create mode 100644 src/main/resources/assets/szar/models/item/wheel.json create mode 100644 src/main/resources/assets/szar/textures/entity/zombie_villager/profession/drog_dealer.png create mode 100644 src/main/resources/assets/szar/textures/item/fasz.png create mode 100644 src/main/resources/assets/szar/textures/item/plane.png create mode 100644 src/main/resources/assets/szar/textures/item/wheel.png create mode 100644 src/main/resources/data/szar/recipes/efn.json create mode 100644 src/main/resources/data/szar/recipes/plane.json create mode 100644 src/main/resources/data/szar/recipes/wheel.json diff --git a/gradle.properties b/gradle.properties index ab0b16e..fa5585a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 loader_version=0.18.3 # Mod Properties -mod_version=26.2.27 +mod_version=26.2.27.1 maven_group=dev.tggamesyt archives_base_name=szar # Dependencies diff --git a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java index 3991f6b..b19d50d 100644 --- a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java +++ b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java @@ -7,6 +7,7 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; @@ -18,12 +19,15 @@ import net.minecraft.client.option.KeyBinding; import net.minecraft.client.render.entity.FlyingItemEntityRenderer; import net.minecraft.client.render.entity.animation.Animation; import net.minecraft.client.render.entity.model.EntityModelLayer; +import net.minecraft.client.render.item.BuiltinModelItemRenderer; +import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.sound.EntityTrackingSoundInstance; import net.minecraft.client.sound.PositionedSoundInstance; import net.minecraft.client.sound.SoundInstance; import net.minecraft.client.sound.SoundManager; import net.minecraft.client.util.InputUtil; import net.minecraft.client.render.*; +import net.minecraft.client.util.ModelIdentifier; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; @@ -75,6 +79,13 @@ public class SzarClient implements ClientModInitializer { int loopStart = startOffset + startLength; @Override public void onInitializeClient() { + ModelLoadingRegistry.INSTANCE.registerModelProvider((manager, out) -> { + ThirdpersonModelRegisterer.getAll().forEach((itemId, modelId) -> { + out.accept(new ModelIdentifier(modelId, "inventory")); + }); + }); + ThirdpersonModelRegisterer.register(new Identifier(MOD_ID, "weed_joint"), new Identifier(MOD_ID, "weed_joint_in_hand")); + ThirdpersonModelRegisterer.register(new Identifier(MOD_ID, "fasz"), new Identifier(MOD_ID, "fasz_in_hand")); ClientTickEvents.END_CLIENT_TICK.register(client -> { if (client.player == null) return; diff --git a/src/client/java/dev/tggamesyt/szar/client/ThirdpersonModelRegisterer.java b/src/client/java/dev/tggamesyt/szar/client/ThirdpersonModelRegisterer.java new file mode 100644 index 0000000..ff87d96 --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/ThirdpersonModelRegisterer.java @@ -0,0 +1,26 @@ +package dev.tggamesyt.szar.client; + +import net.minecraft.util.Identifier; +import net.minecraft.item.Item; +import net.minecraft.registry.Registries; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public class ThirdpersonModelRegisterer { + // Maps base item ID -> custom in-hand model ID + private static final Map CUSTOM_MODELS = new HashMap<>(); + + public static void register(Identifier itemId, Identifier inHandModelId) { + CUSTOM_MODELS.put(itemId, inHandModelId); + } + + public static Identifier get(Item item) { + return CUSTOM_MODELS.get(Registries.ITEM.getId(item)); + } + + public static Map getAll() { + return Collections.unmodifiableMap(CUSTOM_MODELS); + } +} \ No newline at end of file diff --git a/src/client/java/dev/tggamesyt/szar/client/mixin/ItemRendererMixin.java b/src/client/java/dev/tggamesyt/szar/client/mixin/ItemRendererMixin.java new file mode 100644 index 0000000..44bac7b --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/mixin/ItemRendererMixin.java @@ -0,0 +1,55 @@ +package dev.tggamesyt.szar.client.mixin; + +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.item.ItemModels; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.BakedModelManager; +import net.minecraft.client.render.model.json.ModelTransformationMode; +import net.minecraft.client.util.ModelIdentifier; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Identifier; +import net.minecraft.world.World; +import net.minecraft.entity.LivingEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.Redirect; + +import dev.tggamesyt.szar.client.ThirdpersonModelRegisterer; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(ItemRenderer.class) +public abstract class ItemRendererMixin { + + @ModifyVariable( + method = "renderItem(Lnet/minecraft/item/ItemStack;" + + "Lnet/minecraft/client/render/model/json/ModelTransformationMode;" + + "ZLnet/minecraft/client/util/math/MatrixStack;" + + "Lnet/minecraft/client/render/VertexConsumerProvider;" + + "IILnet/minecraft/client/render/model/BakedModel;)V", + at = @At("HEAD"), + argsOnly = true, + ordinal = 0 + ) + private BakedModel swapThirdPersonModel( + BakedModel originalModel, + ItemStack stack, + ModelTransformationMode renderMode + ) { + if (renderMode != ModelTransformationMode.GUI && renderMode != ModelTransformationMode.GROUND) { + + Identifier customId = ThirdpersonModelRegisterer.get(stack.getItem()); + if (customId != null) { + ModelIdentifier modelId = new ModelIdentifier(customId, "inventory"); + ItemRenderer self = (ItemRenderer)(Object)this; + return self.getModels().getModelManager().getModel(modelId); + } + } + + return originalModel; + } +} \ No newline at end of file diff --git a/src/client/resources/szar.client.mixins.json b/src/client/resources/szar.client.mixins.json index 5c5c0e9..59f88c0 100644 --- a/src/client/resources/szar.client.mixins.json +++ b/src/client/resources/szar.client.mixins.json @@ -4,13 +4,14 @@ "package": "dev.tggamesyt.szar.client.mixin", "compatibilityLevel": "JAVA_17", "client": [ + "ItemRendererMixin", "MouseMixin", - "RadiationHeartMixin", + "PlayerModelMixin", "RadiatedItemRendererMixin", + "RadiationHeartMixin", "SplashOverlayMixin", - "TGnameMixin", "TGcapeMixin", - "PlayerModelMixin" + "TGnameMixin" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java b/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java index 2ec00fd..08747c7 100644 --- a/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java +++ b/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java @@ -26,7 +26,7 @@ import java.util.*; public class IslamTerrorist extends PathAwareEntity implements Arrestable{ private BlockPos targetCoreBlock = null; // the core block this mob is attacking - private Vec3d taxiDirection; + private int airTicks = 0; private Vec3d currentDirection = null; // direction plane is moving private BlockPos taxiTarget; private int flyStraightTicks = 0; @@ -68,7 +68,11 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{ Entity vehicle = this.getVehicle(); if (!(vehicle instanceof PlaneEntity plane) || targetCoreBlock == null) return; - + if (plane.isOnGround()) { + airTicks = 0; + } else { + airTicks++; + } Vec3d vel = plane.getVelocity(); // ------------------------- @@ -118,21 +122,38 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{ } // ------------------------- - // HOMING PHASE + // HOMING PHASE (IMPROVED) // ------------------------- Vec3d target = Vec3d.ofCenter(targetCoreBlock); Vec3d toTarget = target.subtract(plane.getPos()); - Vec3d desired = toTarget.normalize().multiply(1.8); - // Add small upward lift if below target - if (plane.getY() < target.y - 10) { - desired = desired.add(0, 0.2, 0); + double distance = toTarget.length(); + Vec3d desiredDir = toTarget.normalize(); + + // Dynamic turning strength (increases over time) + double turnStrength = 0.03 + Math.min(airTicks * 0.002, 0.15); + // After ~60 ticks in air → much stronger turning + + // Stronger correction when close + if (distance < 25) { + turnStrength += 0.05; } - // Smooth turning toward target - currentDirection = currentDirection.lerp(desired.normalize(), 0.03).normalize(); + // Apply turning + currentDirection = currentDirection + .lerp(desiredDir, turnStrength) + .normalize(); - plane.setVelocity(currentDirection.multiply(1.8)); + // Slow slightly when near target to avoid orbiting + double speed = 1.8; + if (distance < 30) { + speed = 1.2; + } + if (distance < 15) { + speed = 0.9; + } + + plane.setVelocity(currentDirection.multiply(speed)); // Face movement Vec3d look = plane.getVelocity().normalize(); @@ -152,7 +173,7 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{ plane.getX(), plane.getY(), plane.getZ(), - 7.0f, + 9.0f, World.ExplosionSourceType.TNT ); @@ -265,7 +286,7 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{ PlaneEntity plane = new PlaneEntity(Szar.PLANE_ENTITY_TYPE, world); plane.refreshPositionAndAngles(getX(), getY(), getZ(), getYaw(), getPitch()); - + this.setInvisible(true); world.spawnEntity(plane); this.startRiding(plane, true); diff --git a/src/main/java/dev/tggamesyt/szar/PlaneEntity.java b/src/main/java/dev/tggamesyt/szar/PlaneEntity.java index 04c6fa2..1952a4b 100644 --- a/src/main/java/dev/tggamesyt/szar/PlaneEntity.java +++ b/src/main/java/dev/tggamesyt/szar/PlaneEntity.java @@ -8,12 +8,14 @@ import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.GameRules; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -21,6 +23,12 @@ public class PlaneEntity extends Entity { private static final TrackedData ENGINE_TARGET = DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.FLOAT); + private static final TrackedData DAMAGE_WOBBLE_TICKS = + DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.INTEGER); + private static final TrackedData DAMAGE_WOBBLE_STRENGTH = + DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.FLOAT); + private static final TrackedData DAMAGE_WOBBLE_SIDE = + DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.INTEGER); private PlaneAnimation currentServerAnimation = null; private float enginePower = 0f; private double lastY; @@ -46,6 +54,9 @@ public class PlaneEntity extends Entity { @Override protected void initDataTracker() { + this.dataTracker.startTracking(DAMAGE_WOBBLE_TICKS, 0); + this.dataTracker.startTracking(DAMAGE_WOBBLE_STRENGTH, 0f); + this.dataTracker.startTracking(DAMAGE_WOBBLE_SIDE, 1); this.dataTracker.startTracking(ENGINE_TARGET, 0f); } @Override @@ -182,7 +193,7 @@ public class PlaneEntity extends Entity { boolean crash = (horizontalImpact > 1.5 && horizontalCollision) || (verticalImpact > explodeSpeed && verticalCollision); if (crash) { - getWorld().createExplosion(this, getX(), getY(), getZ(), 7.0f, World.ExplosionSourceType.TNT); + getWorld().createExplosion(this, getX(), getY(), getZ(), 9.0f, World.ExplosionSourceType.TNT); remove(RemovalReason.KILLED); return; } @@ -271,5 +282,51 @@ public class PlaneEntity extends Entity { } return ActionResult.SUCCESS; } + public void setDamageWobbleTicks(int ticks) { + this.dataTracker.set(DAMAGE_WOBBLE_TICKS, ticks); + } + public int getDamageWobbleTicks() { + return this.dataTracker.get(DAMAGE_WOBBLE_TICKS); + } + + public void setDamageWobbleStrength(float strength) { + this.dataTracker.set(DAMAGE_WOBBLE_STRENGTH, strength); + } + + public float getDamageWobbleStrength() { + return this.dataTracker.get(DAMAGE_WOBBLE_STRENGTH); + } + + public void setDamageWobbleSide(int side) { + this.dataTracker.set(DAMAGE_WOBBLE_SIDE, side); + } + + public int getDamageWobbleSide() { + return this.dataTracker.get(DAMAGE_WOBBLE_SIDE); + } + + private void dropItemAsItem() { + this.dropItem(Szar.PLANE); + } + @Override + public boolean damage(DamageSource source, float amount) { + if (this.isInvulnerableTo(source)) return false; + if (this.getWorld().isClient) return true; + + // wobble effect + this.setDamageWobbleSide(-this.getDamageWobbleSide()); + this.setDamageWobbleTicks(10); + this.setDamageWobbleStrength(this.getDamageWobbleStrength() + amount * 10f); + + boolean isCreative = source.getAttacker() instanceof PlayerEntity player && player.getAbilities().creativeMode; + + if (isCreative || this.getDamageWobbleStrength() > 40f) { + if (!isCreative && this.getWorld().getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) { + this.dropItemAsItem(); // drop plane item + } + this.remove(RemovalReason.KILLED); + } + return true; + } } diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index 26190c4..940f7e3 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -249,8 +249,13 @@ public class Szar implements ModInitializer { .displayName(Text.translatable("itemgroup.szar_group")) .icon(() -> new ItemStack(Szar.CIGANYBLOCK)) // icon item .entries((displayContext, entries) -> { + // drugs + entries.add(Szar.CANNABIS_ITEM); + entries.add(Szar.WEED_ITEM); + entries.add(Szar.WEED_JOINT_ITEM); + entries.add(Szar.CHEMICAL_WORKBENCH_ITEM); + // racism entries.add(Szar.CIGANYBLOCK); - entries.add(Szar.FASZITEM); entries.add(Szar.NWORD_PASS); entries.add(Szar.HITTER_SPAWNEGG); entries.add(Szar.NAZI_SPAWNEGG); @@ -260,9 +265,31 @@ public class Szar implements ModInitializer { entries.add(Szar.POLICE_SPAWNEGG); entries.add(Szar.KEY_ITEM); entries.add(Szar.HANDCUFF_ITEM); - entries.add(Szar.CANNABIS_ITEM); - entries.add(Szar.WEED_ITEM); - entries.add(Szar.WEED_JOINT_ITEM); + // crazy weponary + entries.add(Szar.AK_AMMO); + entries.add(Szar.AK47); + entries.add(Szar.ATOM_DETONATOR); + entries.add(Szar.URANIUM_ORE); + entries.add(Szar.URANIUM); + entries.add(Szar.URANIUM_ROD); + entries.add(Szar.ATOM_CORE); + entries.add(Szar.ATOM); + entries.add(Szar.WHEEL); + entries.add(Szar.PLANE); + // random ahh silly stuff + entries.add(Szar.POPTART); + entries.add(Szar.NYAN_SPAWNEGG); + entries.add(Szar.EPSTEIN_FILES); + entries.add(Szar.EPSTEIN_SPAWNEGG); + entries.add(Szar.BAITER_DISK); + entries.add(Szar.MERL_SPAWNEGG); + entries.add(Szar.EFN_DISK); + // nsfw + entries.add(Szar.FASZITEM); + entries.add(Szar.CNDM); + entries.add(Szar.LATEX); + entries.add(Szar.WHITE_LIQUID); + // niggerite shits at the end entries.add(Szar.NIGGERITE_INGOT); entries.add(Szar.NIGGERITE_SWORD); entries.add(Szar.NIGGERITE_AXE); @@ -274,25 +301,6 @@ public class Szar implements ModInitializer { entries.add(Szar.NIGGERITE_LEGGINGS); entries.add(Szar.NIGGERITE_BOOTS); entries.add(Szar.NIGGERITE_BLOCK); - entries.add(Szar.CHEMICAL_WORKBENCH_ITEM); - entries.add(Szar.AK_AMMO); - entries.add(Szar.AK47); - entries.add(Szar.POPTART); - entries.add(Szar.NYAN_SPAWNEGG); - entries.add(Szar.EPSTEIN_FILES); - entries.add(Szar.EPSTEIN_SPAWNEGG); - entries.add(Szar.ATOM_DETONATOR); - entries.add(Szar.URANIUM_ORE); - entries.add(Szar.URANIUM); - entries.add(Szar.URANIUM_ROD); - entries.add(Szar.ATOM_CORE); - entries.add(Szar.ATOM); - entries.add(Szar.BAITER_DISK); - entries.add(Szar.MERL_SPAWNEGG); - entries.add(Szar.EFN_DISK); - entries.add(Szar.CNDM); - entries.add(Szar.LATEX); - entries.add(Szar.WHITE_LIQUID); }) .build() ); @@ -724,6 +732,19 @@ public class Szar implements ModInitializer { new Identifier(MOD_ID, "latex"), new Item(new Item.Settings()) ); + public static final Item WHEEL = Registry.register( + Registries.ITEM, + new Identifier(MOD_ID, "wheel"), + new Item(new Item.Settings().food(new FoodComponent.Builder().alwaysEdible().hunger(1).build())) + ); + public static final Item PLANE = Registry.register( + Registries.ITEM, + new Identifier(MOD_ID, "plane"), + new SzarSpawnEgg( + PLANE_ENTITY_TYPE, + new Item.Settings() + ) + ); public static final StructurePieceType TNT_OBELISK_PIECE = Registry.register( Registries.STRUCTURE_PIECE, diff --git a/src/main/java/dev/tggamesyt/szar/SzarSpawnEgg.java b/src/main/java/dev/tggamesyt/szar/SzarSpawnEgg.java new file mode 100644 index 0000000..ed565f3 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/SzarSpawnEgg.java @@ -0,0 +1,120 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by Fernflower decompiler) +// + +package dev.tggamesyt.szar; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.FluidBlock; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.MobSpawnerBlockEntity; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnReason; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.passive.PassiveEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.resource.featuretoggle.FeatureSet; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.stat.Stats; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult.Type; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraft.world.RaycastContext.FluidHandling; +import net.minecraft.world.event.GameEvent; +import org.jetbrains.annotations.Nullable; + +public class SzarSpawnEgg extends Item { + private final EntityType type; + + public SzarSpawnEgg(EntityType type, Item.Settings settings) { + super(settings); + this.type = type; + } + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + World world = context.getWorld(); + if (!(world instanceof ServerWorld)) { + return ActionResult.SUCCESS; + } else { + ItemStack itemStack = context.getStack(); + BlockPos blockPos = context.getBlockPos(); + Direction direction = context.getSide(); + BlockState blockState = world.getBlockState(blockPos); + + BlockPos blockPos2; + if (blockState.getCollisionShape(world, blockPos).isEmpty()) { + blockPos2 = blockPos; + } else { + blockPos2 = blockPos.offset(direction); + } + + EntityType entityType2 = this.getEntityType(itemStack.getNbt()); + if (entityType2.spawnFromItemStack((ServerWorld)world, itemStack, context.getPlayer(), blockPos2, SpawnReason.SPAWN_EGG, true, !Objects.equals(blockPos, blockPos2) && direction == Direction.UP) != null) { + itemStack.decrement(1); + world.emitGameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); + } + + return ActionResult.CONSUME; + } + } + @Override + public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + ItemStack itemStack = user.getStackInHand(hand); + BlockHitResult blockHitResult = raycast(world, user, FluidHandling.SOURCE_ONLY); + if (blockHitResult.getType() != Type.BLOCK) { + return TypedActionResult.pass(itemStack); + } else if (!(world instanceof ServerWorld)) { + return TypedActionResult.success(itemStack); + } else { + BlockPos blockPos = blockHitResult.getBlockPos(); + if (!(world.getBlockState(blockPos).getBlock() instanceof FluidBlock)) { + return TypedActionResult.pass(itemStack); + } else if (world.canPlayerModifyAt(user, blockPos) && user.canPlaceOn(blockPos, blockHitResult.getSide(), itemStack)) { + EntityType entityType = this.getEntityType(itemStack.getNbt()); + Entity entity = entityType.spawnFromItemStack((ServerWorld)world, itemStack, user, blockPos, SpawnReason.SPAWN_EGG, false, false); + if (entity == null) { + return TypedActionResult.pass(itemStack); + } else { + if (!user.getAbilities().creativeMode) { + itemStack.decrement(1); + } + + user.incrementStat(Stats.USED.getOrCreateStat(this)); + world.emitGameEvent(user, GameEvent.ENTITY_PLACE, entity.getPos()); + return TypedActionResult.consume(itemStack); + } + } else { + return TypedActionResult.fail(itemStack); + } + } + } + + public EntityType getEntityType(@Nullable NbtCompound nbt) { + if (nbt != null && nbt.contains("EntityTag", 10)) { + NbtCompound nbtCompound = nbt.getCompound("EntityTag"); + if (nbtCompound.contains("id", 8)) { + return EntityType.get(nbtCompound.getString("id")).orElse(this.type); + } + } + + return this.type; + } +} diff --git a/src/main/resources/assets/szar/lang/en_us.json b/src/main/resources/assets/szar/lang/en_us.json index 37b30c4..88c7add 100644 --- a/src/main/resources/assets/szar/lang/en_us.json +++ b/src/main/resources/assets/szar/lang/en_us.json @@ -77,5 +77,7 @@ "item.szar.cndm": "Condom", "item.szar.latex": "Latex", "death.attack.fck": "%1$s got fucked too hard by %2$s", - "item.szar.white_liquid": "..." + "item.szar.white_liquid": "...", + "item.szar.plane": "Plane", + "item.szar.wheel": "Wheel" } diff --git a/src/main/resources/assets/szar/models/item/fasz.json b/src/main/resources/assets/szar/models/item/fasz.json index ef79bb3..0a411c3 100644 --- a/src/main/resources/assets/szar/models/item/fasz.json +++ b/src/main/resources/assets/szar/models/item/fasz.json @@ -1,3 +1,6 @@ { - "parent": "szar:block/fasz" + "parent": "minecraft:item/generated", + "textures": { + "layer0": "szar:item/fasz" + } } diff --git a/src/main/resources/assets/szar/models/item/fasz_in_hand.json b/src/main/resources/assets/szar/models/item/fasz_in_hand.json new file mode 100644 index 0000000..ef79bb3 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/fasz_in_hand.json @@ -0,0 +1,3 @@ +{ + "parent": "szar:block/fasz" +} diff --git a/src/main/resources/assets/szar/models/item/plane.json b/src/main/resources/assets/szar/models/item/plane.json new file mode 100644 index 0000000..8b39627 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/plane.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "szar:item/plane" + } +} diff --git a/src/main/resources/assets/szar/models/item/weed_joint.json b/src/main/resources/assets/szar/models/item/weed_joint.json index 868199c..8392311 100644 --- a/src/main/resources/assets/szar/models/item/weed_joint.json +++ b/src/main/resources/assets/szar/models/item/weed_joint.json @@ -1,32 +1,6 @@ { - "format_version": "1.9.0", - "credit": "Made with Blockbench", + "parent": "minecraft:item/generated", "textures": { - "0": "szar:item/joint3d", - "particle": "szar:item/joint3d" - }, - "elements": [ - { - "from": [7, 0, 7], - "to": [9, 12, 9], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 7]}, - "faces": { - "north": {"uv": [0, 0, 2, 12], "texture": "#0"}, - "east": {"uv": [2, 0, 4, 12], "texture": "#0"}, - "south": {"uv": [4, 0, 6, 12], "texture": "#0"}, - "west": {"uv": [6, 0, 8, 12], "texture": "#0"}, - "up": {"uv": [10, 2, 8, 0], "texture": "#0"}, - "down": {"uv": [10, 2, 8, 4], "texture": "#0"} - } - } - ], - "overrides": [ - { - "predicate": { - "using": 1 - }, - "model": "szar:item/weed_joint_held" - } - ], - "display": {} -} \ No newline at end of file + "layer0": "szar:item/weed_joint" + } +} diff --git a/src/main/resources/assets/szar/models/item/weed_joint_in_hand.json b/src/main/resources/assets/szar/models/item/weed_joint_in_hand.json new file mode 100644 index 0000000..4195561 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/weed_joint_in_hand.json @@ -0,0 +1,23 @@ +{ + "format_version": "1.9.0", + "credit": "Made with Blockbench", + "textures": { + "0": "szar:item/joint3d", + "particle": "szar:item/joint3d" + }, + "elements": [ + { + "from": [7, 0, 7], + "to": [9, 12, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 7]}, + "faces": { + "north": {"uv": [0, 0, 2, 12], "texture": "#0"}, + "east": {"uv": [2, 0, 4, 12], "texture": "#0"}, + "south": {"uv": [4, 0, 6, 12], "texture": "#0"}, + "west": {"uv": [6, 0, 8, 12], "texture": "#0"}, + "up": {"uv": [10, 2, 8, 0], "texture": "#0"}, + "down": {"uv": [10, 2, 8, 4], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/szar/models/item/wheel.json b/src/main/resources/assets/szar/models/item/wheel.json new file mode 100644 index 0000000..19d4fe2 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/wheel.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "szar:item/wheel" + } +} diff --git a/src/main/resources/assets/szar/textures/entity/zombie_villager/profession/drog_dealer.png b/src/main/resources/assets/szar/textures/entity/zombie_villager/profession/drog_dealer.png new file mode 100644 index 0000000000000000000000000000000000000000..adb5f29a50c00b0a24184776a41b55008b84b900 GIT binary patch literal 1235 zcmV;^1T6cBP);6UOa zncsXmsYy@o%LJ`m^*r@SB z5s>8I+7pwViYM2Mky;MCnsfgcGhG8Ei#C5t0@6d6aHGqzO`Ym zaFj34&(E^Izc1U{+d`lA;^IO8bGepXKbjJdht;;zoB*RpX{L)MU}|d0q>wwAo7gvX z$Ccfrde<(gOiBa%p-no^tr@Wda6t;52Ba-%#Z4Jc3mR~DceinYR&_?v##bZ(>=UlR zJ2hGxD=RBTT1o#+}vEPr>Dn&7ahp7=;+(F+DETAJUpyvpYccn?CKA* z6B83c3pC!W)(7=3X&Xs^2KVvtVXo8F)g_;wpQf)mnLkZzx1a z!ZxII1YScccpd}CBy}-F00Hq@iQp)JudlB{@aiRfbc{g~w#?CSyCra2&T79-09xS* zh~U)O)6-KqIXRKX$43MDzO6tIHrO)9*LgsTCu4a*onUyh5e&d_Ru?@jIzKpp4D1*O zjMFj>bc`QSfXWQ6uC4?uEG!6MPL@#Tu?BeLftQyT0eWE2KyeyEXc+_8F$ZuBzyS)} z-Q9Wb@9!QN!ZpwV=4T0}29VkS#|8!l1V;hRPft$^n3kAFv%RFE8c({ywN3 z{1{;@YpAnN!RF?s030L>AOf)BF0f&YZNRTB=5Y<+XGw6<8XX<2kqvKeZ)A_rGdD{x z8K4faS2cLj8|WA$a1vyt+4I-|>H_oB&TTt7I%Ir&+*M~r4hYa72$aBCxuvBg^J0O( z`}_L?r%7!DY-u5ZHjfAhu!ErJ5i|viplB7yBO@cSyu3^|5pHg764|9;6cC^pfD`s= zBYy`62M6Do{_ArC0>}V<^l;SO+uM_)qa*WLiN_m-juvn#WD8(}t^YGrK%A$Gi;Fc7 zH=edWAb|g?-QL~`pu%5YUkg>9N20d$cXoDUcX!tumaql>c4+&5a%l&y_YVj_!OMdG x0dv#BcklZT00960DkeB=00006NklmY<(Z&{Y5c002ovPDHLkV1frKFwX!0 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/szar/textures/item/fasz.png b/src/main/resources/assets/szar/textures/item/fasz.png new file mode 100644 index 0000000000000000000000000000000000000000..bc6f6e657cf6798b1fe7a533bcc7739abf4bbd9a GIT binary patch literal 632 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBuf-vKbiP>*~8rm~MB1$5BeXNr6bM+Ea@{>~aDsl^esu>t; z>?;Zqle1Gx6p~WYGxKcK-|yb9u8^5xs~&FZYv5bpoSKp8QB{;0T;&&%T$P<{nWAoQ z$IE3?VFffHH?<^Dp&~aYuh^=>Rtapd6_5=Q)>pE#DN0GR3UYCSssQqAl`=|73as?? z%gf94%8m8%i_-NCEiEne4UF`SjC6r2bc-wVN)jt{^NN+B2DqdaCl_TFlw{`TDS!-2 zOv*1Uu~jN9%}lXMOH4CON=Y%*O-eLQ(KR$oNz_eDF*ejqF*Z&yH#M{{N;6DSf?8ja znTD`GuNWE(zyQ$)$>>wgQzXDnC zkO2h~Jakj@fI(Ug3_G1EGq{1_UghcH7-Hd{oUlOkL}=K*{~)mQ)T#d$pC&X2#xk&N z$edO4U9YW*hmlQYRwBb)0ksr9ONP~qf7Yyd;l#sZab%;^0fx|?zKx7?*aW!S8W|;C zE^u>ZPM2zEoF;Al;8y^Tf}1hV0iK07xLJ4|%Jj?{6g%JWrkvezgz@@HrI@7Jiie=+ N_jL7hS?83{1OQi5(s)|yBtNcQetFn_VQ`GJ4 zc)4sUtbiuurj{fsROII56ON0GHI_ zN%^HEwo0X?nJHFjiD{-uDJiD9Nr}cOx`u`+iMoj?#)i5n#>Oe;riK zGN53Bhi+;fFi6XRVW%@?1~&r((|J!9$B>G+w=>R8Tx=lFI^T??q>!ucVBgV|JLa4^ z(o{T?d&vUZh7B1}`#ol?eY?I(N~h()-aJoRh9(6L5c&|mDC00+PjOuFon=?50*!eN ze{#<5?MgO(%AdQUXSV3_C2fqWUsy{d^PJ0b;$@CV`}pmBrf)`4gXn+#3r89XWu_M| zJ-1iP%#h(oi}8DoY952Kg|Bz@#WCAmv|n5CrowXfq5J~n`H}n|n3vs;ckyJ~@Mvn# z?4Ne|{kP9$_uTcm%gpfM^X?dbiRB$Z<>6`*LhfH-ZS=YErS+|SXZ+_KH;nVvD0vw% zOn#>M$oiS3w%v*I>t~CGYM3%?&Zu5<>v@O1MR1~J&7-{+?*|=iv1Ln1?1_{;YNHow zyl^VxY#oW?6R)vJ8!d|O4P$FCX6zH(cT2IOx6U<6ieWzIjNTW!@(dSg{1RQ}n9baD zLo;v+@6-j_71}%W-43L;J6tclJnhx#rhs4mUm33^&Dh54o_ZilE8^l|1BYzhwWd>o zF2DP*V+X6h&^hz=H!lTBS1_ISzWLT)bL)%+TmMbjcdleX>Q?Uz=~AxE>(dSdeJH55 zS3i)}aaT3t?t$LJ4^y0l0^5ylxLCEtvaGGJR(-Q`?=-7<-dUY;Zzmi`sXXYN^!s57 ztEqDOc8fy|v4=G6lwU|qJe3m{62FDnS@@yd!hL0Y%U*Q7>Mm2*An#oCaFOq2TT!K3 zSCfOjxLRAx*!RA0_uY(Yqd5gf&j`8mUP*~8rm~MB1$5BeXNr6bM+Ea@{>~aDsl^esu>t; z>?;Zqle1Gx6p~WYGxKcK-|yb9u8^5xs~&FZYv5bpoSKp8QB{;0T;&&%T$P<{nWAoQ z$IE3?VFffHH?<^Dp&~aYuh^=>Rtapd6_5=Q)>pE#DN0GR3UYCSssQqAl`=|73as?? z%gf94%8m8%i_-NCEiEne4UF`SjC6r2bc-wVN)jt{^NN+B2DqdaCl_TFlw{`TDS!-2 zOv*1Uu~jN9%}lXMOH4CON=Y%*O-eLQ(KR$oNz_eDF*ejqF*Z&yH#M{{N;6DSf?8ja znTD`GuNWE(zyQ$)$>>wgQzXDnC zkO2h~Jakj@fI(Ug3_G1EGq{1_?%?U-7-Hd{oUlN^KxyND<&B+;Jq1lXXAKUVXwh@h zlBi%VXmhNswdLBsaid@>KkH#Do(`77nmiIGIM`G6K4E6iF5!?kW|mq6ibPLWKbLh* G2~7Yd{