diff --git a/gradle.properties b/gradle.properties index 096470e..ce5b9c4 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=1.0.9 +mod_version=1.0.10 maven_group=dev.tggamesyt archives_base_name=szar # Dependencies diff --git a/src/client/java/dev/tggamesyt/szar/client/PoliceEntityRenderer.java b/src/client/java/dev/tggamesyt/szar/client/PoliceEntityRenderer.java new file mode 100644 index 0000000..dd1e032 --- /dev/null +++ b/src/client/java/dev/tggamesyt/szar/client/PoliceEntityRenderer.java @@ -0,0 +1,27 @@ +package dev.tggamesyt.szar.client; + +import dev.tggamesyt.szar.NiggerEntity; +import dev.tggamesyt.szar.PoliceEntity; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.MobEntityRenderer; +import net.minecraft.client.render.entity.model.BipedEntityModel; +import net.minecraft.client.render.entity.model.EntityModelLayers; +import net.minecraft.util.Identifier; + +public class PoliceEntityRenderer + extends MobEntityRenderer> { + + public PoliceEntityRenderer(EntityRendererFactory.Context context) { + super( + context, + new BipedEntityModel<>(context.getPart(EntityModelLayers.PLAYER)), + 0.5F + ); + } + + @Override + public Identifier getTexture(PoliceEntity entity) { + return new Identifier("szar", "textures/entity/police-man.png"); + } +} + diff --git a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java index 32572d4..208b7e2 100644 --- a/src/client/java/dev/tggamesyt/szar/client/SzarClient.java +++ b/src/client/java/dev/tggamesyt/szar/client/SzarClient.java @@ -41,6 +41,10 @@ public class SzarClient implements ClientModInitializer { Szar.NiggerEntityType, NiggerEntityRenderer::new ); + EntityRendererRegistry.register( + Szar.PoliceEntityType, + PoliceEntityRenderer::new + ); EntityRendererRegistry.register( Szar.TERRORIST_ENTITY_TYPE, TerroristEntityRenderer::new diff --git a/src/main/java/dev/tggamesyt/szar/AggroOnHitRevengeGoal.java b/src/main/java/dev/tggamesyt/szar/AggroOnHitRevengeGoal.java new file mode 100644 index 0000000..5847866 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/AggroOnHitRevengeGoal.java @@ -0,0 +1,82 @@ +package dev.tggamesyt.szar; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.TargetPredicate; +import net.minecraft.entity.ai.goal.TrackTargetGoal; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.util.math.Box; +import net.minecraft.predicate.entity.EntityPredicates; + +import java.util.EnumSet; +import java.util.List; + +public class AggroOnHitRevengeGoal extends TrackTargetGoal { + + private static final TargetPredicate VALID_TARGET = + TargetPredicate.createAttackable().ignoreVisibility().ignoreDistanceScalingFactor(); + + private int lastHurtTime; + private int lastAttackTime; + + public AggroOnHitRevengeGoal(PathAwareEntity mob) { + super(mob, true); + this.setControls(EnumSet.of(Control.TARGET)); + } + + @Override + public boolean canStart() { + LivingEntity attacker = this.mob.getAttacker(); + LivingEntity target = this.mob.getTarget(); + + int hurtTime = this.mob.getLastAttackedTime(); + int attackTime = this.mob.getLastAttackTime(); + + // Trigger if mob was hurt + if (attacker != null && hurtTime != this.lastHurtTime) { + return this.canTrack(attacker, VALID_TARGET); + } + + // Trigger if mob attacked someone + if (target != null && attackTime != this.lastAttackTime) { + return this.canTrack(target, VALID_TARGET); + } + + return false; + } + + @Override + public void start() { + LivingEntity target = + this.mob.getAttacker() != null + ? this.mob.getAttacker() + : this.mob.getTarget(); + + this.mob.setTarget(target); + + this.lastHurtTime = this.mob.getLastAttackedTime(); + this.lastAttackTime = this.mob.getLastAttackTime(); + + this.callForHelp(target); + + super.start(); + } + + protected void callForHelp(LivingEntity target) { + double range = this.getFollowRange(); + Box box = this.mob.getBoundingBox().expand(range, 10.0D, range); + + List allies = + this.mob.getWorld().getEntitiesByClass( + this.mob.getClass(), + box, + EntityPredicates.EXCEPT_SPECTATOR + ); + + for (MobEntity ally : allies) { + if (ally != this.mob && ally.getTarget() == null) { + ally.setTarget(target); + } + } + } +} diff --git a/src/main/java/dev/tggamesyt/szar/ArrestedEffect.java b/src/main/java/dev/tggamesyt/szar/ArrestedEffect.java new file mode 100644 index 0000000..73b9719 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/ArrestedEffect.java @@ -0,0 +1,51 @@ +package dev.tggamesyt.szar; + +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.attribute.AttributeContainer; +import net.minecraft.entity.attribute.EntityAttributes; +import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffectCategory; +import net.minecraft.entity.mob.MobEntity; + +public class ArrestedEffect extends StatusEffect { + + private static double originalspeed; + public ArrestedEffect() { + // BENEFICIAL = false because it's like a debuff + super(StatusEffectCategory.HARMFUL, 0xA0A0A0); // gray color + } + + @Override + public void applyUpdateEffect(LivingEntity entity, int amplifier) { + // This method is called every tick while the effect is active + if (!entity.getWorld().isClient) { + // Stop movement completely + entity.setVelocity(0, entity.getVelocity().y, 0); // keep Y velocity (falling) if you want + entity.velocityModified = true; + + // Stop AI for mobs + if (entity instanceof MobEntity mob) { + mob.getNavigation().stop(); + mob.setTarget(null); + } + + // Optional: reset movement speed to 0 + originalspeed = entity.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED).getValue(); + entity.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED) + .setBaseValue(0.0D); + } + } + + @Override + public boolean canApplyUpdateEffect(int duration, int amplifier) { + // Run every tick + return true; + } + + @Override + public void onRemoved(LivingEntity entity, AttributeContainer attributes, int amplifier) { + // Reset movement speed when effect ends + entity.getAttributeInstance(EntityAttributes.GENERIC_MOVEMENT_SPEED) + .setBaseValue(originalspeed); // default walking speed for mobs + } +} diff --git a/src/main/java/dev/tggamesyt/szar/CannabisPatchFeature.java b/src/main/java/dev/tggamesyt/szar/CannabisPatchFeature.java new file mode 100644 index 0000000..d770ea8 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/CannabisPatchFeature.java @@ -0,0 +1,58 @@ +package dev.tggamesyt.szar; + +import com.mojang.serialization.Codec; +import dev.tggamesyt.szar.Szar; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.StructureWorldAccess; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.feature.util.FeatureContext; + +public class CannabisPatchFeature extends Feature { + + public CannabisPatchFeature(Codec codec) { + super(codec); + } + + @Override + public boolean generate(FeatureContext context) { + StructureWorldAccess world = context.getWorld(); + BlockPos origin = context.getOrigin(); + Random random = context.getRandom(); + + int cannabisCount = 2 + random.nextInt(5); // 2–6 + int tallCount = random.nextInt(3); // 0–2 + + int placed = 0; + + for (int i = 0; i < cannabisCount + tallCount; i++) { + BlockPos pos = origin.add( + random.nextInt(6) - 3, + 0, + random.nextInt(6) - 3 + ); + + pos = world.getTopPosition( + net.minecraft.world.Heightmap.Type.WORLD_SURFACE, + pos + ); + + if (!world.getBlockState(pos.down()).isSolidBlock(world, pos.down())) { + continue; + } + + BlockState state = + tallCount > 0 + ? Szar.TALL_CANNABIS_BLOCK.getDefaultState() + : Szar.CANNABIS_BLOCK.getDefaultState(); + + if (tallCount > 0) tallCount--; + + world.setBlockState(pos, state, 3); + placed++; + } + + return placed > 0; + } +} diff --git a/src/main/java/dev/tggamesyt/szar/CannabisPatchFeatureConfig.java b/src/main/java/dev/tggamesyt/szar/CannabisPatchFeatureConfig.java new file mode 100644 index 0000000..5846479 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/CannabisPatchFeatureConfig.java @@ -0,0 +1,11 @@ +package dev.tggamesyt.szar; + +import com.mojang.serialization.Codec; +import net.minecraft.world.gen.feature.FeatureConfig; + +public class CannabisPatchFeatureConfig implements FeatureConfig { + + public static final Codec CODEC = + Codec.unit(new CannabisPatchFeatureConfig()); + +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/GypsyEntity.java b/src/main/java/dev/tggamesyt/szar/GypsyEntity.java index efd27f5..ed9c9ce 100644 --- a/src/main/java/dev/tggamesyt/szar/GypsyEntity.java +++ b/src/main/java/dev/tggamesyt/szar/GypsyEntity.java @@ -20,6 +20,8 @@ import java.util.*; public class GypsyEntity extends PathAwareEntity { + public static boolean arrestable = false; + private final DefaultedList stolenItems = DefaultedList.of(); private final Set stolenFromPlayers = new HashSet<>(); @@ -247,6 +249,7 @@ public class GypsyEntity extends PathAwareEntity { if (mob.distanceTo(target) < 1.3) { mob.trySteal(target); + arrestable = true; } } } diff --git a/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java b/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java index 4371334..66d8c4f 100644 --- a/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java +++ b/src/main/java/dev/tggamesyt/szar/IslamTerrorist.java @@ -22,6 +22,7 @@ import java.util.*; public class IslamTerrorist extends PathAwareEntity { + public static boolean arrestable = false; private int BlowUpCooldown = 0; private int panicTicks = 0; private UUID fleeingFrom = null; @@ -186,6 +187,7 @@ public class IslamTerrorist extends PathAwareEntity { if (mob.distanceTo(target) < 1.3) { mob.triggerExposion(target); + arrestable = true; } } } diff --git a/src/main/java/dev/tggamesyt/szar/NiggerEntity.java b/src/main/java/dev/tggamesyt/szar/NiggerEntity.java index f5b3b8f..dfc812f 100644 --- a/src/main/java/dev/tggamesyt/szar/NiggerEntity.java +++ b/src/main/java/dev/tggamesyt/szar/NiggerEntity.java @@ -1,33 +1,44 @@ package dev.tggamesyt.szar; import dev.tggamesyt.szar.Szar; +import dev.tggamesyt.szar.AggroOnHitRevengeGoal; import net.minecraft.entity.EntityType; -import net.minecraft.entity.ai.goal.LookAroundGoal; -import net.minecraft.entity.ai.goal.WanderAroundFarGoal; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.goal.*; import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.world.World; +import java.util.List; + public class NiggerEntity extends PathAwareEntity { + public static boolean arrestable = true; + public NiggerEntity(EntityType type, World world) { super(type, world); } @Override protected void initGoals() { - this.goalSelector.add(1, new WanderAroundFarGoal(this, 1.0D)); - this.goalSelector.add(2, new LookAroundGoal(this)); + this.goalSelector.add(0, new MeleeAttackGoal(this, 1.2D, true)); + this.goalSelector.add(2, new WanderAroundFarGoal(this, 1.0D)); + this.goalSelector.add(3, new LookAroundGoal(this)); + + this.targetSelector.add(1, new AggroOnHitRevengeGoal(this)); } + public static DefaultAttributeContainer.Builder createAttributes() { return MobEntity.createMobAttributes() .add(EntityAttributes.GENERIC_MAX_HEALTH, 20.0) - .add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25); + .add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25) + .add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 2); } @Override diff --git a/src/main/java/dev/tggamesyt/szar/PoliceArrestGoal.java b/src/main/java/dev/tggamesyt/szar/PoliceArrestGoal.java new file mode 100644 index 0000000..2b65baa --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/PoliceArrestGoal.java @@ -0,0 +1,120 @@ +package dev.tggamesyt.szar; + +import dev.tggamesyt.szar.Szar; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.TargetPredicate; +import net.minecraft.entity.ai.goal.Goal; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Hand; + +import java.util.EnumSet; +import java.util.List; + +public class PoliceArrestGoal extends Goal { + private final PathAwareEntity police; + private LivingEntity target; + private static final int ARREST_DURATION = 2400; // 2 minutes in ticks + + public PoliceArrestGoal(PathAwareEntity police) { + this.police = police; + this.setControls(EnumSet.of(Control.MOVE, Control.TARGET)); + } + + @Override + public boolean canStart() { + // 1️⃣ Find nearest arrestable mob + List nearby = police.getWorld().getEntitiesByClass( + MobEntity.class, + police.getBoundingBox().expand(16), + mob -> isArrestable(mob) + ); + + if (!nearby.isEmpty()) { + target = nearby.get(0); + return true; + } + + // 2️⃣ Find entities attacking villagers or police + List possibleTargets = police.getWorld().getEntitiesByClass( + LivingEntity.class, + police.getBoundingBox().expand(16), + entity -> isAttackingProtected(entity) + ); + + if (!possibleTargets.isEmpty()) { + target = possibleTargets.get(0); + return true; + } + + return false; + } + + @Override + public void start() { + police.getNavigation().startMovingTo(target, 1.2D); + } + + @Override + public void tick() { + if (target == null || !target.isAlive()) { + police.setTarget(null); + return; + } + + police.setTarget(target); + police.getNavigation().startMovingTo(target, 1.2D); + + double distanceSq = police.squaredDistanceTo(target); + if (distanceSq < 4.0D) { // ~2 blocks + // Swing the hand + police.swingHand(Hand.MAIN_HAND); + + // Deal half a heart using vanilla attack system + police.tryAttack(target); // this uses vanilla attack logic and triggers death messages + + // Apply arrested effect + target.addStatusEffect(new net.minecraft.entity.effect.StatusEffectInstance( + Szar.ARRESTED, ARREST_DURATION, 0 + )); + + // Reset target so Police doesn’t spam the effect + target = null; + } + } + + + + @Override + public boolean shouldContinue() { + return target != null && target.isAlive(); + } + + private boolean isArrestable(MobEntity mob) { + try { + return mob.getClass().getField("arrestable").getBoolean(null); + } catch (NoSuchFieldException | IllegalAccessException e) { + return false; + } + } + + private boolean isAttackingProtected(LivingEntity entity) { + // Check if entity is currently attacking a villager or police + if (entity instanceof MobEntity mob) { + LivingEntity targetEntity = mob.getTarget(); + if (targetEntity instanceof PlayerEntity player) { + return false; // optional: ignore if player attacking non-protected + } + return targetEntity instanceof MobEntity protectedEntity && + (protectedEntity instanceof PathAwareEntity p && p.getClass() == police.getClass() + || protectedEntity.getType().getSpawnGroup().isPeaceful()); + } else if (entity instanceof PlayerEntity) { + // Check if player recently attacked villager or police + // You may need to track recent attacks in an event listener + return false; // placeholder, can be implemented via attack events + } + return false; + } +} diff --git a/src/main/java/dev/tggamesyt/szar/PoliceEntity.java b/src/main/java/dev/tggamesyt/szar/PoliceEntity.java new file mode 100644 index 0000000..d058d68 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/PoliceEntity.java @@ -0,0 +1,54 @@ +package dev.tggamesyt.szar; + +import dev.tggamesyt.szar.AggroOnHitRevengeGoal; +import dev.tggamesyt.szar.PoliceArrestGoal; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnReason; +import net.minecraft.entity.ai.goal.LookAroundGoal; +import net.minecraft.entity.ai.goal.WanderAroundFarGoal; +import net.minecraft.entity.attribute.DefaultAttributeContainer; +import net.minecraft.entity.attribute.EntityAttributes; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.mob.MobEntity; +import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.item.Items; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.ServerWorldAccess; +import net.minecraft.world.World; + +public class PoliceEntity extends PathAwareEntity { + + public PoliceEntity(EntityType type, World world) { + super(type, world); + } + + @Override + protected void initGoals() { + // PoliceArrestGoal replaces normal melee behavior + this.goalSelector.add(0, new PoliceArrestGoal(this)); + + this.goalSelector.add(2, new WanderAroundFarGoal(this, 1.0D)); + this.goalSelector.add(3, new LookAroundGoal(this)); + + this.targetSelector.add(1, new AggroOnHitRevengeGoal(this)); + } + + public static DefaultAttributeContainer.Builder createAttributes() { + return MobEntity.createMobAttributes() + .add(EntityAttributes.GENERIC_MAX_HEALTH, 20.0) + .add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25) + .add(EntityAttributes.GENERIC_ATTACK_DAMAGE, 1.0); // half heart + } + public static boolean canSpawnHere(EntityType type, ServerWorldAccess world, SpawnReason reason, BlockPos pos, Random random) { + // Only spawn near players + return world.getClosestPlayer(pos.getX(), pos.getY(), pos.getZ(), 48, false) != null + && world.getLightLevel(pos) > 8; // optional, spawn in light + } + + + @Override + protected void dropLoot(DamageSource source, boolean causedByPlayer) { + this.dropItem(Items.DEBUG_STICK); + } +} diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index 13c530f..368587a 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -19,9 +19,11 @@ import net.minecraft.block.*; import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; +import net.minecraft.entity.SpawnRestriction; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.item.*; import net.minecraft.registry.*; +import net.minecraft.registry.tag.BiomeTags; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.sound.SoundEvents; import net.minecraft.text.Text; @@ -30,8 +32,10 @@ import net.minecraft.util.Identifier; import net.minecraft.util.collection.DataPool; import net.minecraft.village.TradeOffer; import net.minecraft.village.VillagerProfession; +import net.minecraft.world.Heightmap; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeKeys; +import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.feature.*; import net.minecraft.world.gen.placementmodifier.BiomePlacementModifier; import net.minecraft.world.gen.placementmodifier.CountPlacementModifier; @@ -88,6 +92,15 @@ public class Szar implements ModInitializer { .dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized .build() ); + public static final EntityType PoliceEntityType = + Registry.register( + Registries.ENTITY_TYPE, + new Identifier(MOD_ID, "police"), + FabricEntityTypeBuilder + .create(SpawnGroup.CREATURE, PoliceEntity::new) + .dimensions(EntityDimensions.fixed(0.6F, 1.8F)) // player-sized + .build() + ); public static final EntityType GYPSY_ENTITY_TYPE = Registry.register( Registries.ENTITY_TYPE, @@ -119,6 +132,7 @@ public class Szar implements ModInitializer { entries.add(Szar.NIGGER_SPAWNEGG); entries.add(Szar.GYPSY_SPAWNEGG); entries.add(Szar.TERRORIST_SPAWNEGG); + entries.add(Szar.POLICE_SPAWNEGG); entries.add(Szar.CANNABIS_ITEM); entries.add(Szar.WEED_ITEM); entries.add(Szar.WEED_JOINT_ITEM); @@ -277,6 +291,10 @@ public class Szar implements ModInitializer { NiggerEntityType, NiggerEntity.createAttributes() ); + FabricDefaultAttributeRegistry.register( + PoliceEntityType, + NiggerEntity.createAttributes() + ); FabricDefaultAttributeRegistry.register( GYPSY_ENTITY_TYPE, GypsyEntity.createAttributes() @@ -285,6 +303,12 @@ public class Szar implements ModInitializer { TERRORIST_ENTITY_TYPE, IslamTerrorist.createAttributes() ); + SpawnRestriction.register( + Szar.PoliceEntityType, + SpawnRestriction.Location.ON_GROUND, // spawn on solid blocks + Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, // avoids leaves + PoliceEntity::canSpawnHere // your custom condition + ); ServerTickEvents.END_SERVER_TICK.register(PlayerValueTimer::onServerTick); BiomeModifications.addSpawn( BiomeSelectors.includeByKey( @@ -323,27 +347,21 @@ public class Szar implements ModInitializer { 1, // min group size 5 // max group size ); - } - BlockStateProvider provider = - new WeightedBlockStateProvider( - DataPool.builder() - .add(Szar.CANNABIS_BLOCK.getDefaultState(), 8) - .add(Szar.TALL_CANNABIS_BLOCK.getDefaultState(), 1) - .build() - ); + BiomeModifications.addFeature( + BiomeSelectors.tag(BiomeTags.IS_JUNGLE), + GenerationStep.Feature.VEGETAL_DECORATION, + RegistryKey.of( + RegistryKeys.PLACED_FEATURE, + new Identifier("szar", "cannabis_patch") + ) + ); - ConfiguredFeature patch = - new ConfiguredFeature<>( - Feature.RANDOM_PATCH, - new RandomPatchFeatureConfig( - 32, - 6, - 3, - PlacedFeatures.createEntry( - Feature.SIMPLE_BLOCK, - new SimpleBlockFeatureConfig(provider) - ) - ) + } + public static final Feature CANNABIS_PATCH = + Registry.register( + Registries.FEATURE, + new Identifier("szar", "cannabis_patch"), + new CannabisPatchFeature(CannabisPatchFeatureConfig.CODEC) ); public static final Map PLAYER_JOINT_LEVEL = new HashMap<>(); public static final Map PLAYER_ADDICTION_LEVEL = new HashMap<>(); @@ -352,6 +370,7 @@ public class Szar implements ModInitializer { new Identifier(MOD_ID, "drog"), new DrogEffect() ); + public static final StatusEffect ARRESTED = Registry.register(Registries.STATUS_EFFECT, new Identifier("szar", "arrested"), new ArrestedEffect()); public static final Item CHEMICAL_WORKBENCH_ITEM = Registry.register( Registries.ITEM, new Identifier(MOD_ID, "chemical_workbench"), @@ -511,6 +530,16 @@ public class Szar implements ModInitializer { new Item.Settings() ) ); + public static final Item POLICE_SPAWNEGG = Registry.register( + Registries.ITEM, + new Identifier(MOD_ID, "police_spawn_egg"), + new SpawnEggItem( + PoliceEntityType, + 0x0000FF, + 0xFF0000, + new Item.Settings() + ) + ); public static final Item GYPSY_SPAWNEGG = Registry.register( Registries.ITEM, new Identifier(MOD_ID, "gypsy_spawn_egg"), diff --git a/src/main/resources/assets/szar/lang/en_us.json b/src/main/resources/assets/szar/lang/en_us.json index 3d47bce..410c1e4 100644 --- a/src/main/resources/assets/szar/lang/en_us.json +++ b/src/main/resources/assets/szar/lang/en_us.json @@ -26,5 +26,8 @@ "block.szar.chemical_workbench": "Chemical Workbench", "entity.minecraft.villager.drog_dealer": "Drog dealer", "entity.szar.islam_terrorist": "Islam Terrorist", - "item.szar.terrorist_spawn_egg": "Islam Terrorist Spawn Egg" + "item.szar.terrorist_spawn_egg": "Islam Terrorist Spawn Egg", + "entity.szar.police": "Police Man", + "item.szar.police_spawn_egg": "Police Man Spawn Egg", + "effect.szar.arrested": "Arrested" } diff --git a/src/main/resources/assets/szar/models/block/chemical_workbench.json b/src/main/resources/assets/szar/models/block/chemical_workbench.json index 039a2a0..7bdf736 100644 --- a/src/main/resources/assets/szar/models/block/chemical_workbench.json +++ b/src/main/resources/assets/szar/models/block/chemical_workbench.json @@ -1,28 +1,12 @@ { - "format_version": "1.9.0", - "credit": "Made with Blockbench", - "texture_size": [64, 64], + "parent": "block/cube", "textures": { - "0": "szar:block/chemical_1", - "1": "szar:block/chemical_2", - "2": "szar:block/chemical_3", - "3": "szar:block/chemical_4", - "4": "szar:block/chemical_bottom", - "5": "szar:block/chemical_top", + "north": "szar:block/chemical_1", + "east": "szar:block/chemical_2", + "south": "szar:block/chemical_3", + "west": "szar:block/chemical_4", + "up": "szar:block/chemical_top", + "down": "szar:block/chemical_bottom", "particle": "szar:block/chemical_1" - }, - "elements": [ - { - "from": [0, 0, 0], - "to": [16, 16, 16], - "faces": { - "north": {"uv": [0, 0, 16, 16], "texture": "#3"}, - "east": {"uv": [0, 0, 16, 16], "texture": "#2"}, - "south": {"uv": [0, 0, 16, 16], "texture": "#1"}, - "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, - "up": {"uv": [15.73333, 16, 0, 0], "texture": "#5"}, - "down": {"uv": [16, 0, 0, 16], "texture": "#4"} - } - } - ] -} \ No newline at end of file + } +} diff --git a/src/main/resources/assets/szar/models/item/police_spawn_egg.json b/src/main/resources/assets/szar/models/item/police_spawn_egg.json new file mode 100644 index 0000000..ddd1559 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/police_spawn_egg.json @@ -0,0 +1,3 @@ +{ + "parent": "minecraft:item/template_spawn_egg" +} diff --git a/src/main/resources/assets/szar/textures/entity/police-man.png b/src/main/resources/assets/szar/textures/entity/police-man.png new file mode 100644 index 0000000..e64b59b Binary files /dev/null and b/src/main/resources/assets/szar/textures/entity/police-man.png differ diff --git a/src/main/resources/assets/szar/textures/mob_effect/arrested.png b/src/main/resources/assets/szar/textures/mob_effect/arrested.png new file mode 100644 index 0000000..1976f31 Binary files /dev/null and b/src/main/resources/assets/szar/textures/mob_effect/arrested.png differ diff --git a/src/main/resources/data/szar/recipes/chemical_workbench.json b/src/main/resources/data/szar/recipes/chemical_workbench.json new file mode 100644 index 0000000..f229c5c --- /dev/null +++ b/src/main/resources/data/szar/recipes/chemical_workbench.json @@ -0,0 +1,23 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "SSS", + "PCP", + "PPP" + ], + "key": { + "S": { + "item": "minecraft:smooth_stone" + }, + "P": { + "tag": "minecraft:planks" + }, + "C": { + "item": "szar:cannabis" + } + }, + "result": { + "item": "szar:chemical_workbench", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/szar/worldgen/configured_feature/cannabis_patch.json b/src/main/resources/data/szar/worldgen/configured_feature/cannabis_patch.json new file mode 100644 index 0000000..5e4f88a --- /dev/null +++ b/src/main/resources/data/szar/worldgen/configured_feature/cannabis_patch.json @@ -0,0 +1,4 @@ +{ + "type": "szar:cannabis_patch", + "config": {} +} diff --git a/src/main/resources/data/szar/worldgen/placed_feature/cannabis_patch.json b/src/main/resources/data/szar/worldgen/placed_feature/cannabis_patch.json new file mode 100644 index 0000000..528de6c --- /dev/null +++ b/src/main/resources/data/szar/worldgen/placed_feature/cannabis_patch.json @@ -0,0 +1,19 @@ +{ + "feature": "szar:cannabis_patch", + "placement": [ + { + "type": "minecraft:count", + "count": 2 + }, + { + "type": "minecraft:in_square" + }, + { + "type": "minecraft:heightmap", + "heightmap": "WORLD_SURFACE_WG" + }, + { + "type": "minecraft:biome" + } + ] +}