some cleanup, 3d modeling stuff and terrorist plane fixes
This commit is contained in:
@@ -6,7 +6,7 @@ minecraft_version=1.20.1
|
|||||||
yarn_mappings=1.20.1+build.10
|
yarn_mappings=1.20.1+build.10
|
||||||
loader_version=0.18.3
|
loader_version=0.18.3
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=26.2.27
|
mod_version=26.2.27.1
|
||||||
maven_group=dev.tggamesyt
|
maven_group=dev.tggamesyt
|
||||||
archives_base_name=szar
|
archives_base_name=szar
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.fabricmc.api.ClientModInitializer;
|
|||||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
|
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.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.networking.v1.ClientPlayNetworking;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
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.FlyingItemEntityRenderer;
|
||||||
import net.minecraft.client.render.entity.animation.Animation;
|
import net.minecraft.client.render.entity.animation.Animation;
|
||||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
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.EntityTrackingSoundInstance;
|
||||||
import net.minecraft.client.sound.PositionedSoundInstance;
|
import net.minecraft.client.sound.PositionedSoundInstance;
|
||||||
import net.minecraft.client.sound.SoundInstance;
|
import net.minecraft.client.sound.SoundInstance;
|
||||||
import net.minecraft.client.sound.SoundManager;
|
import net.minecraft.client.sound.SoundManager;
|
||||||
import net.minecraft.client.util.InputUtil;
|
import net.minecraft.client.util.InputUtil;
|
||||||
import net.minecraft.client.render.*;
|
import net.minecraft.client.render.*;
|
||||||
|
import net.minecraft.client.util.ModelIdentifier;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -75,6 +79,13 @@ public class SzarClient implements ClientModInitializer {
|
|||||||
int loopStart = startOffset + startLength;
|
int loopStart = startOffset + startLength;
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
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 -> {
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
if (client.player == null) return;
|
if (client.player == null) return;
|
||||||
|
|
||||||
|
|||||||
@@ -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<Identifier, Identifier> 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<Identifier, Identifier> getAll() {
|
||||||
|
return Collections.unmodifiableMap(CUSTOM_MODELS);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,13 +4,14 @@
|
|||||||
"package": "dev.tggamesyt.szar.client.mixin",
|
"package": "dev.tggamesyt.szar.client.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"client": [
|
"client": [
|
||||||
|
"ItemRendererMixin",
|
||||||
"MouseMixin",
|
"MouseMixin",
|
||||||
"RadiationHeartMixin",
|
"PlayerModelMixin",
|
||||||
"RadiatedItemRendererMixin",
|
"RadiatedItemRendererMixin",
|
||||||
|
"RadiationHeartMixin",
|
||||||
"SplashOverlayMixin",
|
"SplashOverlayMixin",
|
||||||
"TGnameMixin",
|
|
||||||
"TGcapeMixin",
|
"TGcapeMixin",
|
||||||
"PlayerModelMixin"
|
"TGnameMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class IslamTerrorist extends PathAwareEntity implements Arrestable{
|
public class IslamTerrorist extends PathAwareEntity implements Arrestable{
|
||||||
private BlockPos targetCoreBlock = null; // the core block this mob is attacking
|
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 Vec3d currentDirection = null; // direction plane is moving
|
||||||
private BlockPos taxiTarget;
|
private BlockPos taxiTarget;
|
||||||
private int flyStraightTicks = 0;
|
private int flyStraightTicks = 0;
|
||||||
@@ -68,7 +68,11 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{
|
|||||||
|
|
||||||
Entity vehicle = this.getVehicle();
|
Entity vehicle = this.getVehicle();
|
||||||
if (!(vehicle instanceof PlaneEntity plane) || targetCoreBlock == null) return;
|
if (!(vehicle instanceof PlaneEntity plane) || targetCoreBlock == null) return;
|
||||||
|
if (plane.isOnGround()) {
|
||||||
|
airTicks = 0;
|
||||||
|
} else {
|
||||||
|
airTicks++;
|
||||||
|
}
|
||||||
Vec3d vel = plane.getVelocity();
|
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 target = Vec3d.ofCenter(targetCoreBlock);
|
||||||
Vec3d toTarget = target.subtract(plane.getPos());
|
Vec3d toTarget = target.subtract(plane.getPos());
|
||||||
Vec3d desired = toTarget.normalize().multiply(1.8);
|
|
||||||
|
|
||||||
// Add small upward lift if below target
|
double distance = toTarget.length();
|
||||||
if (plane.getY() < target.y - 10) {
|
Vec3d desiredDir = toTarget.normalize();
|
||||||
desired = desired.add(0, 0.2, 0);
|
|
||||||
|
// 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
|
// Apply turning
|
||||||
currentDirection = currentDirection.lerp(desired.normalize(), 0.03).normalize();
|
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
|
// Face movement
|
||||||
Vec3d look = plane.getVelocity().normalize();
|
Vec3d look = plane.getVelocity().normalize();
|
||||||
@@ -152,7 +173,7 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{
|
|||||||
plane.getX(),
|
plane.getX(),
|
||||||
plane.getY(),
|
plane.getY(),
|
||||||
plane.getZ(),
|
plane.getZ(),
|
||||||
7.0f,
|
9.0f,
|
||||||
World.ExplosionSourceType.TNT
|
World.ExplosionSourceType.TNT
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -265,7 +286,7 @@ public class IslamTerrorist extends PathAwareEntity implements Arrestable{
|
|||||||
|
|
||||||
PlaneEntity plane = new PlaneEntity(Szar.PLANE_ENTITY_TYPE, world);
|
PlaneEntity plane = new PlaneEntity(Szar.PLANE_ENTITY_TYPE, world);
|
||||||
plane.refreshPositionAndAngles(getX(), getY(), getZ(), getYaw(), getPitch());
|
plane.refreshPositionAndAngles(getX(), getY(), getZ(), getYaw(), getPitch());
|
||||||
|
this.setInvisible(true);
|
||||||
world.spawnEntity(plane);
|
world.spawnEntity(plane);
|
||||||
this.startRiding(plane, true);
|
this.startRiding(plane, true);
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ import net.minecraft.entity.data.DataTracker;
|
|||||||
import net.minecraft.entity.data.TrackedData;
|
import net.minecraft.entity.data.TrackedData;
|
||||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.vehicle.BoatEntity;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
@@ -21,6 +23,12 @@ public class PlaneEntity extends Entity {
|
|||||||
|
|
||||||
private static final TrackedData<Float> ENGINE_TARGET =
|
private static final TrackedData<Float> ENGINE_TARGET =
|
||||||
DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.FLOAT);
|
DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.FLOAT);
|
||||||
|
private static final TrackedData<Integer> DAMAGE_WOBBLE_TICKS =
|
||||||
|
DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.INTEGER);
|
||||||
|
private static final TrackedData<Float> DAMAGE_WOBBLE_STRENGTH =
|
||||||
|
DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.FLOAT);
|
||||||
|
private static final TrackedData<Integer> DAMAGE_WOBBLE_SIDE =
|
||||||
|
DataTracker.registerData(PlaneEntity.class, TrackedDataHandlerRegistry.INTEGER);
|
||||||
private PlaneAnimation currentServerAnimation = null;
|
private PlaneAnimation currentServerAnimation = null;
|
||||||
private float enginePower = 0f;
|
private float enginePower = 0f;
|
||||||
private double lastY;
|
private double lastY;
|
||||||
@@ -46,6 +54,9 @@ public class PlaneEntity extends Entity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initDataTracker() {
|
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);
|
this.dataTracker.startTracking(ENGINE_TARGET, 0f);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@@ -182,7 +193,7 @@ public class PlaneEntity extends Entity {
|
|||||||
|
|
||||||
boolean crash = (horizontalImpact > 1.5 && horizontalCollision) || (verticalImpact > explodeSpeed && verticalCollision);
|
boolean crash = (horizontalImpact > 1.5 && horizontalCollision) || (verticalImpact > explodeSpeed && verticalCollision);
|
||||||
if (crash) {
|
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);
|
remove(RemovalReason.KILLED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -271,5 +282,51 @@ public class PlaneEntity extends Entity {
|
|||||||
}
|
}
|
||||||
return ActionResult.SUCCESS;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,8 +249,13 @@ public class Szar implements ModInitializer {
|
|||||||
.displayName(Text.translatable("itemgroup.szar_group"))
|
.displayName(Text.translatable("itemgroup.szar_group"))
|
||||||
.icon(() -> new ItemStack(Szar.CIGANYBLOCK)) // icon item
|
.icon(() -> new ItemStack(Szar.CIGANYBLOCK)) // icon item
|
||||||
.entries((displayContext, entries) -> {
|
.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.CIGANYBLOCK);
|
||||||
entries.add(Szar.FASZITEM);
|
|
||||||
entries.add(Szar.NWORD_PASS);
|
entries.add(Szar.NWORD_PASS);
|
||||||
entries.add(Szar.HITTER_SPAWNEGG);
|
entries.add(Szar.HITTER_SPAWNEGG);
|
||||||
entries.add(Szar.NAZI_SPAWNEGG);
|
entries.add(Szar.NAZI_SPAWNEGG);
|
||||||
@@ -260,9 +265,31 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.POLICE_SPAWNEGG);
|
entries.add(Szar.POLICE_SPAWNEGG);
|
||||||
entries.add(Szar.KEY_ITEM);
|
entries.add(Szar.KEY_ITEM);
|
||||||
entries.add(Szar.HANDCUFF_ITEM);
|
entries.add(Szar.HANDCUFF_ITEM);
|
||||||
entries.add(Szar.CANNABIS_ITEM);
|
// crazy weponary
|
||||||
entries.add(Szar.WEED_ITEM);
|
entries.add(Szar.AK_AMMO);
|
||||||
entries.add(Szar.WEED_JOINT_ITEM);
|
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_INGOT);
|
||||||
entries.add(Szar.NIGGERITE_SWORD);
|
entries.add(Szar.NIGGERITE_SWORD);
|
||||||
entries.add(Szar.NIGGERITE_AXE);
|
entries.add(Szar.NIGGERITE_AXE);
|
||||||
@@ -274,25 +301,6 @@ public class Szar implements ModInitializer {
|
|||||||
entries.add(Szar.NIGGERITE_LEGGINGS);
|
entries.add(Szar.NIGGERITE_LEGGINGS);
|
||||||
entries.add(Szar.NIGGERITE_BOOTS);
|
entries.add(Szar.NIGGERITE_BOOTS);
|
||||||
entries.add(Szar.NIGGERITE_BLOCK);
|
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()
|
.build()
|
||||||
);
|
);
|
||||||
@@ -724,6 +732,19 @@ public class Szar implements ModInitializer {
|
|||||||
new Identifier(MOD_ID, "latex"),
|
new Identifier(MOD_ID, "latex"),
|
||||||
new Item(new Item.Settings())
|
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 =
|
public static final StructurePieceType TNT_OBELISK_PIECE =
|
||||||
Registry.register(
|
Registry.register(
|
||||||
Registries.STRUCTURE_PIECE,
|
Registries.STRUCTURE_PIECE,
|
||||||
|
|||||||
120
src/main/java/dev/tggamesyt/szar/SzarSpawnEgg.java
Normal file
120
src/main/java/dev/tggamesyt/szar/SzarSpawnEgg.java
Normal file
@@ -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<? extends Entity> 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<ItemStack> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,5 +77,7 @@
|
|||||||
"item.szar.cndm": "Condom",
|
"item.szar.cndm": "Condom",
|
||||||
"item.szar.latex": "Latex",
|
"item.szar.latex": "Latex",
|
||||||
"death.attack.fck": "%1$s got fucked too hard by %2$s",
|
"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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"parent": "szar:block/fasz"
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/fasz"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"parent": "szar:block/fasz"
|
||||||
|
}
|
||||||
6
src/main/resources/assets/szar/models/item/plane.json
Normal file
6
src/main/resources/assets/szar/models/item/plane.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/plane"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +1,6 @@
|
|||||||
{
|
{
|
||||||
"format_version": "1.9.0",
|
"parent": "minecraft:item/generated",
|
||||||
"credit": "Made with Blockbench",
|
|
||||||
"textures": {
|
"textures": {
|
||||||
"0": "szar:item/joint3d",
|
"layer0": "szar:item/weed_joint"
|
||||||
"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": {}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
6
src/main/resources/assets/szar/models/item/wheel.json
Normal file
6
src/main/resources/assets/szar/models/item/wheel.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "szar:item/wheel"
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/resources/assets/szar/textures/item/fasz.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/fasz.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 632 B |
BIN
src/main/resources/assets/szar/textures/item/plane.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/plane.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/resources/assets/szar/textures/item/wheel.png
Normal file
BIN
src/main/resources/assets/szar/textures/item/wheel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 574 B |
@@ -5,11 +5,10 @@
|
|||||||
"tag": "minecraft:music_discs"
|
"tag": "minecraft:music_discs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"item": "szar:epstein_files"
|
"item": "szar:fasz"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"result": {
|
"result": {
|
||||||
"item": "szar:baiter",
|
"item": "szar:baiter"
|
||||||
"count": 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
14
src/main/resources/data/szar/recipes/efn.json
Normal file
14
src/main/resources/data/szar/recipes/efn.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shapeless",
|
||||||
|
"ingredients": [
|
||||||
|
{
|
||||||
|
"tag": "minecraft:music_discs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"item": "szar:epstein_files"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"result": {
|
||||||
|
"item": "szar:efn"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,15 +6,11 @@
|
|||||||
"SSS"
|
"SSS"
|
||||||
],
|
],
|
||||||
"key": {
|
"key": {
|
||||||
"S": {
|
"S": { "item": "minecraft:sugar" },
|
||||||
"item": "minecraft:sugar"
|
"L": { "item": "minecraft:slime_ball" }
|
||||||
},
|
|
||||||
"L": {
|
|
||||||
"item": "minecraft:slime_ball"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"result": {
|
"result": {
|
||||||
"item": "szar:latex",
|
"item": "szar:latex",
|
||||||
"count": 1
|
"count": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
19
src/main/resources/data/szar/recipes/plane.json
Normal file
19
src/main/resources/data/szar/recipes/plane.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"GBB",
|
||||||
|
"IFB",
|
||||||
|
"W W"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"G": { "item": "minecraft:glass" },
|
||||||
|
"B": { "item": "minecraft:iron_block" },
|
||||||
|
"I": { "item": "minecraft:iron_ingot" },
|
||||||
|
"F": { "item": "minecraft:furnace" },
|
||||||
|
"W": { "item": "szar:wheel" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "szar:plane",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
16
src/main/resources/data/szar/recipes/wheel.json
Normal file
16
src/main/resources/data/szar/recipes/wheel.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"BLB",
|
||||||
|
"LBL",
|
||||||
|
"BLB"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"B": { "item": "minecraft:black_dye" },
|
||||||
|
"L": { "item": "szar:latex" }
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "szar:wheel",
|
||||||
|
"count": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user