实现更多TODO

This commit is contained in:
Light_Quanta 2025-03-29 10:25:00 +08:00
parent d5bbb7c224
commit 5d8e1b3614
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
39 changed files with 262 additions and 235 deletions

View file

@ -1,7 +1,11 @@
package com.atsuishio.superbwarfare.block;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
@ -16,6 +20,7 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -84,10 +89,9 @@ public class BarbedWireBlock extends Block {
public void entityInside(BlockState blockstate, Level world, BlockPos pos, Entity entity) {
super.entityInside(blockstate, world, pos, entity);
// TODO vehicle process
// if (!(entity instanceof VehicleEntity)) {
// entity.makeStuckInBlock(Blocks.AIR.defaultBlockState(), new Vec3(0.15, 0.04, 0.15));
// entity.hurt(new DamageSource(world.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.CACTUS)), 2);
// }
if (!(entity instanceof VehicleEntity)) {
entity.makeStuckInBlock(Blocks.AIR.defaultBlockState(), new Vec3(0.15, 0.04, 0.15));
entity.hurt(new DamageSource(world.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.CACTUS)), 2);
}
}
}

View file

@ -5,8 +5,11 @@ import com.atsuishio.superbwarfare.init.ModBlockEntities;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.mojang.serialization.MapCodec;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.InteractionHand;
@ -132,33 +135,40 @@ public class ContainerBlock extends BaseEntityBlock {
public void appendHoverText(ItemStack stack, Item.TooltipContext context, List<Component> tooltipComponents, TooltipFlag tooltipFlag) {
super.appendHoverText(stack, context, tooltipComponents, tooltipFlag);
// TODO read NBT
// CompoundTag tag = BlockItem.getBlockEntityData(pStack);
// if (tag != null && tag.contains("EntityType")) {
// String s = getEntityTranslationKey(tag.getString("EntityType"));
// tooltipComponents.add(Component.translatable(s == null ? "des.superbwarfare.container.empty" : s).withStyle(ChatFormatting.GRAY));
//
// var entityType = EntityType.byString(tag.getString("EntityType")).orElse(null);
// if (entityType != null) {
// int w = 0, h = 0;
// if (level instanceof Level level && tag.contains("Entity")) {
// var entity = entityType.create(level);
// if (entity != null) {
// entity.load(tag.getCompound("Entity"));
// w = (int) (entity.getType().getDimensions().width() + 1);
// if (w % 2 == 0) w++;
// h = (int) (entity.getType().getDimensions().height() + 1);
// }
// } else {
// w = (int) (entityType.getDimensions().width() + 1);
// if (w % 2 == 0) w++;
// h = (int) (entityType.getDimensions().height() + 1);
// }
// if (w != 0 && h != 0) {
// tooltipComponents.add(Component.literal(w + " x " + w + " x " + h).withStyle(ChatFormatting.YELLOW));
// }
// }
// }
var data = stack.get(DataComponents.BLOCK_ENTITY_DATA);
CompoundTag tag = data != null ? data.copyTag() : new CompoundTag();
if (tag.contains("EntityType")) {
String s = getEntityTranslationKey(tag.getString("EntityType"));
tooltipComponents.add(Component.translatable(s == null ? "des.superbwarfare.container.empty" : s).withStyle(ChatFormatting.GRAY));
var entityType = EntityType.byString(tag.getString("EntityType")).orElse(null);
if (entityType != null) {
int w = 0, h = 0;
Level level = null;
try {
level = context.level();
} catch (Exception ignored) {
}
if (level != null && tag.contains("Entity")) {
var entity = entityType.create(level);
if (entity != null) {
entity.load(tag.getCompound("Entity"));
w = (int) (entity.getType().getDimensions().width() + 1);
if (w % 2 == 0) w++;
h = (int) (entity.getType().getDimensions().height() + 1);
}
} else {
w = (int) (entityType.getDimensions().width() + 1);
if (w % 2 == 0) w++;
h = (int) (entityType.getDimensions().height() + 1);
}
if (w != 0 && h != 0) {
tooltipComponents.add(Component.literal(w + " x " + w + " x " + h).withStyle(ChatFormatting.YELLOW));
}
}
}
}
@Nullable
@ -209,8 +219,7 @@ public class ContainerBlock extends BaseEntityBlock {
@ParametersAreNonnullByDefault
public @NotNull ItemStack getCloneItemStack(BlockState state, HitResult target, LevelReader level, BlockPos pos, Player player) {
var itemStack = super.getCloneItemStack(state, target, level, pos, player);
// TODO saveToItem
// level.getBlockEntity(pos, ModBlockEntities.CONTAINER.get()).ifPresent((blockEntity) -> blockEntity.saveToItem(itemStack));
level.getBlockEntity(pos, ModBlockEntities.CONTAINER.get()).ifPresent((blockEntity) -> blockEntity.saveToItem(itemStack, level.registryAccess()));
return itemStack;
}

View file

@ -1,6 +1,8 @@
package com.atsuishio.superbwarfare.block;
import com.atsuishio.superbwarfare.capability.ModCapabilities;
import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
import com.atsuishio.superbwarfare.init.ModSounds;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -104,8 +106,7 @@ public class JumpPadBlock extends Block {
super.entityInside(blockstate, level, pos, entity);
// 禁止套娃
// TODO 套娃处理
// if (entity instanceof TargetEntity || entity instanceof CannonEntity) return;
if (entity instanceof TargetEntity || entity instanceof CannonEntity) return;
if (entity.isShiftKeyDown()) {
if (entity.onGround()) {

View file

@ -156,7 +156,7 @@ public class ClickHandler {
&& weaponVehicle.hasWeapon(vehicle.getSeatIndex(player))
) {
int index = vehicle.getSeatIndex(player);
PacketDistributor.sendToServer(new SwitchVehicleWeaponMessage(index, -scroll, true));
// PacketDistributor.sendToServer(new SwitchVehicleWeaponMessage(index, -scroll, true));
event.setCanceled(true);
}
@ -164,9 +164,9 @@ public class ClickHandler {
if (stack.is(ModTags.Items.GUN) && ClientEventHandler.zoom) {
if (GunsTool.getGunBooleanTag(stack, "CanSwitchScope", false)) {
PacketDistributor.sendToServer(new SwitchScopeMessage(scroll));
// PacketDistributor.sendToServer(new SwitchScopeMessage(scroll));
} else if (tag.getBoolean("CanAdjustZoomFov") || stack.is(ModItems.MINIGUN.get())) {
PacketDistributor.sendToServer(new AdjustZoomFovMessage(scroll));
// PacketDistributor.sendToServer(new AdjustZoomFovMessage(scroll));
}
event.setCanceled(true);
}
@ -179,7 +179,7 @@ public class ClickHandler {
Entity looking = TraceTool.findLookingEntity(player, 6);
if (looking == null) return;
if (looking instanceof MortarEntity && player.isShiftKeyDown()) {
PacketDistributor.sendToServer(new AdjustMortarAngleMessage(scroll));
// PacketDistributor.sendToServer(new AdjustMortarAngleMessage(scroll));
event.setCanceled(true);
}
}
@ -208,20 +208,20 @@ public class ClickHandler {
// }
if (key == ModKeyMappings.RELOAD.getKey().getValue()) {
PacketDistributor.sendToServer(new ReloadMessage(0));
// PacketDistributor.sendToServer(new ReloadMessage(0));
}
if (key == ModKeyMappings.FIRE_MODE.getKey().getValue()) {
PacketDistributor.sendToServer(new FireModeMessage(0));
// PacketDistributor.sendToServer(new FireModeMessage(0));
}
if (key == ModKeyMappings.INTERACT.getKey().getValue()) {
PacketDistributor.sendToServer(new InteractMessage(0));
// PacketDistributor.sendToServer(new InteractMessage(0));
}
if (key == ModKeyMappings.DISMOUNT.getKey().getValue()) {
handleDismountPress(player);
}
if (key == ModKeyMappings.EDIT_MODE.getKey().getValue() && ClientEventHandler.burstFireSize == 0) {
ClientEventHandler.holdFire = false;
PacketDistributor.sendToServer(new EditModeMessage(0));
// PacketDistributor.sendToServer(new EditModeMessage(0));
}
var cap = player.getCapability(ModCapabilities.PLAYER_VARIABLE);
@ -229,30 +229,30 @@ public class ClickHandler {
if (!(stack.getItem() instanceof GunItem gunItem)) return;
if (ModKeyMappings.EDIT_GRIP.getKeyModifier().isActive(KeyConflictContext.IN_GAME)) {
if (key == ModKeyMappings.EDIT_GRIP.getKey().getValue() && gunItem.hasCustomGrip(stack)) {
PacketDistributor.sendToServer(new EditMessage(4));
// PacketDistributor.sendToServer(new EditMessage(4));
editModelShake();
}
} else {
if (key == ModKeyMappings.EDIT_SCOPE.getKey().getValue() && gunItem.hasCustomScope(stack)) {
PacketDistributor.sendToServer(new EditMessage(0));
// PacketDistributor.sendToServer(new EditMessage(0));
editModelShake();
} else if (key == ModKeyMappings.EDIT_BARREL.getKey().getValue() && gunItem.hasCustomBarrel(stack)) {
PacketDistributor.sendToServer(new EditMessage(1));
// PacketDistributor.sendToServer(new EditMessage(1));
editModelShake();
} else if (key == ModKeyMappings.EDIT_MAGAZINE.getKey().getValue() && gunItem.hasCustomMagazine(stack)) {
PacketDistributor.sendToServer(new EditMessage(2));
// PacketDistributor.sendToServer(new EditMessage(2));
editModelShake();
} else if (key == ModKeyMappings.EDIT_STOCK.getKey().getValue() && gunItem.hasCustomStock(stack)) {
PacketDistributor.sendToServer(new EditMessage(3));
// PacketDistributor.sendToServer(new EditMessage(3));
editModelShake();
}
}
}
if (key == ModKeyMappings.SENSITIVITY_INCREASE.getKey().getValue()) {
PacketDistributor.sendToServer(new SensitivityMessage(true));
// PacketDistributor.sendToServer(new SensitivityMessage(true));
}
if (key == ModKeyMappings.SENSITIVITY_REDUCE.getKey().getValue()) {
PacketDistributor.sendToServer(new SensitivityMessage(false));
// PacketDistributor.sendToServer(new SensitivityMessage(false));
}
if (stack.is(ModTags.Items.GUN)
@ -295,11 +295,11 @@ public class ClickHandler {
if (player.hasEffect(ModMobEffects.SHOCK)) return;
if (stack.is(Items.SPYGLASS) && player.isScoping() && player.getOffhandItem().is(ModItems.FIRING_PARAMETERS.get())) {
PacketDistributor.sendToServer(new SetFiringParametersMessage(0));
// PacketDistributor.sendToServer(new SetFiringParametersMessage(0));
}
if (stack.is(ModItems.MONITOR.get())) {
PacketDistributor.sendToServer(new DroneFireMessage(0));
// PacketDistributor.sendToServer(new DroneFireMessage(0));
}
@ -328,10 +328,10 @@ public class ClickHandler {
if (!gunItem.useBackpackAmmo(stack) && GunsTool.getGunIntTag(stack, "Ammo", 0) <= 0 && GunsTool.getGunIntTag(stack, "ReloadTime") == 0) {
if (ReloadConfig.LEFT_CLICK_RELOAD.get()) {
PacketDistributor.sendToServer(new ReloadMessage(0));
// PacketDistributor.sendToServer(new ReloadMessage(0));
}
} else {
PacketDistributor.sendToServer(new FireMessage(0));
// PacketDistributor.sendToServer(new FireMessage(0));
if (!stack.is(ModItems.BOCEK.get())) {
ClientEventHandler.holdFire = true;
}
@ -343,14 +343,14 @@ public class ClickHandler {
}
public static void handleWeaponFireRelease() {
PacketDistributor.sendToServer(new FireMessage(1));
// PacketDistributor.sendToServer(new FireMessage(1));
ClientEventHandler.holdFire = false;
ClientEventHandler.holdFireVehicle = false;
ClientEventHandler.customRpm = 0;
}
public static void handleWeaponZoomPress(Player player, ItemStack stack) {
PacketDistributor.sendToServer(new ZoomMessage(0));
// PacketDistributor.sendToServer(new ZoomMessage(0));
if (player.getVehicle() instanceof VehicleEntity pVehicle && player.getVehicle() instanceof WeaponVehicleEntity iVehicle && iVehicle.hasWeapon(pVehicle.getSeatIndex(player))) {
ClientEventHandler.zoomVehicle = true;
@ -367,7 +367,7 @@ public class ClickHandler {
}
public static void handleWeaponZoomRelease() {
PacketDistributor.sendToServer(new ZoomMessage(1));
// PacketDistributor.sendToServer(new ZoomMessage(1));
ClientEventHandler.zoom = false;
ClientEventHandler.zoomVehicle = false;
ClientEventHandler.entity = null;
@ -415,6 +415,6 @@ public class ClickHandler {
ClientEventHandler.dismountCountdown = 20;
return;
}
PacketDistributor.sendToServer(new PlayerStopRidingMessage(0));
// PacketDistributor.sendToServer(new PlayerStopRidingMessage(0));
}
}

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.client.model.item;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.gun.smg.VectorItem;
@ -128,8 +129,7 @@ public class VectorItemModel extends GeoModel<VectorItem> {
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.95 : 0.9) * zt)));
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
// TODO cross hair overlay gun rot
// CrossHairOverlay.gunRot = shen.getRotZ();
CrossHairOverlay.gunRot = shen.getRotZ();
cross1.setPosY(-0.25f * (float) fpz);

View file

@ -157,7 +157,9 @@ public abstract class AbstractLaserEntityRenderer<T extends AbstractLaserEntity>
protected void drawVertex(Matrix4f matrix, Matrix3f normals, VertexConsumer vertexBuilder, float offsetX, float offsetY, float offsetZ, float textureX, float textureY, int packedLightIn) {
// TODO drawVertex
// vertexBuilder.addVertex(matrix, offsetX, offsetY, offsetZ).setColor(1F, 1F, 1F, 1F).setUv(textureX, textureY).setOverlay(OverlayTexture.NO_OVERLAY).setLight(packedLightIn).setNormal(normals, 0.0F, 1.0F, 0.0F).endVertex();
// vertexBuilder.addVertex(matrix, offsetX, offsetY, offsetZ).setColor(1F, 1F, 1F, 1F).setUv(textureX, textureY).setOverlay(OverlayTexture.NO_OVERLAY).setLight(packedLightIn)
// .setNormal(normals, 0.0F, 1.0F, 0.0F)
// .endVertex();
}
}

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.AK12Layer;
import com.atsuishio.superbwarfare.client.model.item.AK12ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -128,8 +129,7 @@ public class AK12ItemRenderer extends GeoItemRenderer<AK12Item> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
}
if (this.transformType.firstPerson() && renderingArms) {

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.AK47Layer;
import com.atsuishio.superbwarfare.client.model.item.AK47ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -146,8 +147,7 @@ public class AK47ItemRenderer extends GeoItemRenderer<AK47Item> {
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.MAGAZINE) != 2);
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
}

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.Aa12Layer;
import com.atsuishio.superbwarfare.client.model.item.Aa12ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -96,8 +97,7 @@ public class Aa12ItemRenderer extends GeoItemRenderer<Aa12Item> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
}
if (this.transformType.firstPerson() && renderingArms) {

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.Hk416Layer;
import com.atsuishio.superbwarfare.client.model.item.Hk416ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -125,8 +126,7 @@ public class Hk416ItemRenderer extends GeoItemRenderer<Hk416Item> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.M4Layer;
import com.atsuishio.superbwarfare.client.model.item.M4ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -136,8 +137,7 @@ public class M4ItemRenderer extends GeoItemRenderer<M4Item> {
bone.setHidden(GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.SCOPE) == 3);
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.Mk14Layer;
import com.atsuishio.superbwarfare.client.model.item.Mk14ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -129,8 +130,7 @@ public class Mk14ItemRenderer extends GeoItemRenderer<Mk14Item> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.Ntw20Layer;
import com.atsuishio.superbwarfare.client.model.item.Ntw20Model;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -129,8 +130,7 @@ public class Ntw20Renderer extends GeoItemRenderer<Ntw20Item> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.Qbz95Layer;
import com.atsuishio.superbwarfare.client.model.item.Qbz95ItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -137,8 +138,7 @@ public class Qbz95ItemRenderer extends GeoItemRenderer<Qbz95Item> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.SvdLayer;
import com.atsuishio.superbwarfare.client.model.item.SvdItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -122,8 +123,7 @@ public class SvdItemRenderer extends GeoItemRenderer<SvdItem> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.TracheliumLayer;
import com.atsuishio.superbwarfare.client.layer.gun.TracheliumLightLayer;
import com.atsuishio.superbwarfare.client.model.item.TracheliumItemModel;
@ -128,8 +129,7 @@ public class TracheliumItemRenderer extends GeoItemRenderer<Trachelium> {
bone.setHidden(!NBTTool.getTag(itemStack).getBoolean("HoloHidden") && ClientEventHandler.zoom);
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (name.equals("flare")) {
if (ClientEventHandler.firePosTimer == 0 || ClientEventHandler.firePosTimer > 0.5 || GunsTool.getAttachmentType(itemStack, GunsTool.AttachmentType.BARREL) == 2) {

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.client.renderer.item;
import com.atsuishio.superbwarfare.client.AnimationHelper;
import com.atsuishio.superbwarfare.client.ItemModelHelper;
import com.atsuishio.superbwarfare.client.layer.gun.VectorLayer;
import com.atsuishio.superbwarfare.client.model.item.VectorItemModel;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
@ -113,8 +114,7 @@ public class VectorItemRenderer extends GeoItemRenderer<VectorItem> {
}
}
// TODO handle gun attachments
// ItemModelHelper.handleGunAttachments(bone, itemStack, name);
ItemModelHelper.handleGunAttachments(bone, itemStack, name);
if (this.transformType.firstPerson() && renderingArms) {
AbstractClientPlayer localPlayer = mc.player;

View file

@ -3,6 +3,7 @@ package com.atsuishio.superbwarfare.client.screens;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.block.entity.FuMO25BlockEntity;
import com.atsuishio.superbwarfare.client.RenderHelper;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.menu.FuMO25Menu;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.mojang.blaze3d.platform.GlStateManager;
@ -163,12 +164,10 @@ public class FuMO25Screen extends AbstractContainerScreen<FuMO25Menu> {
if (currentTarget instanceof LivingEntity living) {
sb.append(" (HP: ").append(FormatTool.format1D(living.getHealth()))
.append("/").append(FormatTool.format1D(living.getMaxHealth())).append(")");
} else if (currentTarget instanceof VehicleEntity vehicle) {
sb.append(" (HP: ").append(FormatTool.format1D(vehicle.getHealth()))
.append("/").append(FormatTool.format1D(vehicle.getMaxHealth())).append(")");
}
// TODO vehicle
// else if (currentTarget instanceof VehicleEntity vehicle) {
// sb.append(" (HP: ").append(FormatTool.format1D(vehicle.getHealth()))
// .append("/").append(FormatTool.format1D(vehicle.getMaxHealth())).append(")");
// }
guiGraphics.drawString(this.font, Component.translatable("des.superbwarfare.fumo_25.current_target", sb),
i + 173, j + 24, 0xffffff);

View file

@ -1,6 +1,12 @@
package com.atsuishio.superbwarfare.client.tooltip;
import com.atsuishio.superbwarfare.client.TooltipTool;
import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent;
import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.perk.PerkHelper;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.atsuishio.superbwarfare.tools.GunsTool;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
public class ClientLauncherImageTooltip extends ClientGunImageTooltip {
@ -11,18 +17,16 @@ public class ClientLauncherImageTooltip extends ClientGunImageTooltip {
@Override
protected Component getDamageComponent() {
// TODO GunInfo
// double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
// int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.MICRO_MISSILE.get(), stack);
// if (perkLevel > 0) damage *= 1.1f + perkLevel * 0.1f;
//
// double explosionDamage = GunsTool.getGunDoubleTag(stack, "ExplosionDamage", 0);
double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.MICRO_MISSILE.get(), stack);
if (perkLevel > 0) damage *= 1.1f + perkLevel * 0.1f;
// return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
// .append(Component.literal(FormatTool.format1D(damage)).withStyle(ChatFormatting.GREEN)
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
// .append(Component.literal(" + " + FormatTool.format1D(explosionDamage)).withStyle(ChatFormatting.GOLD)));
return Component.literal("");
double explosionDamage = GunsTool.getGunDoubleTag(stack, "ExplosionDamage", 0);
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(FormatTool.format1D(damage)).withStyle(ChatFormatting.GREEN)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(" + " + FormatTool.format1D(explosionDamage)).withStyle(ChatFormatting.GOLD)));
}
}

View file

@ -1,6 +1,12 @@
package com.atsuishio.superbwarfare.client.tooltip;
import com.atsuishio.superbwarfare.client.TooltipTool;
import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent;
import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.perk.PerkHelper;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.atsuishio.superbwarfare.tools.GunsTool;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
public class ClientSecondaryCataclysmImageTooltip extends ClientEnergyImageTooltip {
@ -11,18 +17,16 @@ public class ClientSecondaryCataclysmImageTooltip extends ClientEnergyImageToolt
@Override
protected Component getDamageComponent() {
// TODO GunInfo
// double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
// int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.MICRO_MISSILE.get(), stack);
// if (perkLevel > 0) damage *= 1.1f + perkLevel * 0.1f;
//
// double explosionDamage = GunsTool.getGunDoubleTag(stack, "ExplosionDamage", 0);
//
// return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
// .append(Component.literal(FormatTool.format1D(damage)).withStyle(ChatFormatting.GREEN)
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
// .append(Component.literal(" + " + FormatTool.format1D(explosionDamage)).withStyle(ChatFormatting.GOLD)));
return Component.literal("");
double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
int perkLevel = PerkHelper.getItemPerkLevel(ModPerks.MICRO_MISSILE.get(), stack);
if (perkLevel > 0) damage *= 1.1f + perkLevel * 0.1f;
double explosionDamage = GunsTool.getGunDoubleTag(stack, "ExplosionDamage", 0);
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(FormatTool.format1D(damage)).withStyle(ChatFormatting.GREEN)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(" + " + FormatTool.format1D(explosionDamage)).withStyle(ChatFormatting.GOLD)));
}
}

View file

@ -1,6 +1,10 @@
package com.atsuishio.superbwarfare.client.tooltip;
import com.atsuishio.superbwarfare.client.TooltipTool;
import com.atsuishio.superbwarfare.client.tooltip.component.GunImageComponent;
import com.atsuishio.superbwarfare.tools.FormatTool;
import com.atsuishio.superbwarfare.tools.GunsTool;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.neoforged.neoforge.capabilities.Capabilities;
@ -14,24 +18,21 @@ public class ClientSentinelImageTooltip extends ClientEnergyImageTooltip {
protected Component getDamageComponent() {
var cap = stack.getCapability(Capabilities.EnergyStorage.ITEM);
// TODO GunInfo
if (cap != null && cap.getEnergyStored() > 0) {
// double damage = (GunsTool.getGunDoubleTag(stack, "Damage", 0) +
// GunsTool.getGunDoubleTag(stack, "ChargedDamage", 0))
// * TooltipTool.perkDamage(stack);
// return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
// .append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ? " + " +
// FormatTool.format1D(0.8 * damage * (1 + 0.1 * TooltipTool.heBulletLevel(stack))) : ""))
// .withStyle(ChatFormatting.AQUA).withStyle(ChatFormatting.BOLD));
double damage = (GunsTool.getGunDoubleTag(stack, "Damage", 0) +
GunsTool.getGunDoubleTag(stack, "ChargedDamage", 0))
* TooltipTool.perkDamage(stack);
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ? " + " +
FormatTool.format1D(0.8 * damage * (1 + 0.1 * TooltipTool.heBulletLevel(stack))) : ""))
.withStyle(ChatFormatting.AQUA).withStyle(ChatFormatting.BOLD));
} else {
// double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
// return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
// .append(Component.literal("").withStyle(ChatFormatting.RESET))
// .append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ?
// FormatTool.format1D(0.4 * damage * (1 + 0.1 * TooltipTool.heBulletLevel(stack))) : "")).withStyle(ChatFormatting.GREEN));
}
return Component.literal("");
double damage = GunsTool.getGunDoubleTag(stack, "Damage", 0) * TooltipTool.perkDamage(stack);
return Component.translatable("des.superbwarfare.guns.damage").withStyle(ChatFormatting.GRAY)
.append(Component.literal("").withStyle(ChatFormatting.RESET))
.append(Component.literal(FormatTool.format1D(damage) + (TooltipTool.heBullet(stack) ?
FormatTool.format1D(0.4 * damage * (1 + 0.1 * TooltipTool.heBulletLevel(stack))) : "")).withStyle(ChatFormatting.GREEN));
}
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.world.entity.LivingEntity;
/**
* Codes Based On @TACZ
*/
// TODO
public interface ICustomKnockback {
static ICustomKnockback getInstance(LivingEntity entity) {

View file

@ -4,7 +4,6 @@ import com.atsuishio.superbwarfare.block.BarbedWireBlock;
import com.atsuishio.superbwarfare.component.ModDataComponents;
import com.atsuishio.superbwarfare.config.server.MiscConfig;
import com.atsuishio.superbwarfare.config.server.ProjectileConfig;
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.init.*;
@ -574,10 +573,10 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
living.addDeltaMovement(vec3.scale(knockback));
performDamage(entity, damage, headshot);
} else {
ICustomKnockback iCustomKnockback = ICustomKnockback.getInstance(living);
iCustomKnockback.superbWarfare$setKnockbackStrength(knockback);
// ICustomKnockback iCustomKnockback = ICustomKnockback.getInstance(living);
// iCustomKnockback.superbWarfare$setKnockbackStrength(knockback);
performDamage(entity, damage, headshot);
iCustomKnockback.superbWarfare$resetKnockbackStrength();
// iCustomKnockback.superbWarfare$resetKnockbackStrength();
}
} else {
performDamage(entity, damage, headshot);

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.entity.vehicle.base;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
@ -209,10 +210,9 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
preventStacking();
crushEntities(this.getDeltaMovement());
// TODO drone
// if (!(this instanceof DroneEntity)) {
// this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.06, 0.0));
// }
if (!(this instanceof DroneEntity)) {
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.06, 0.0));
}
this.move(MoverType.SELF, this.getDeltaMovement());
collideLilyPadBlock();
@ -380,10 +380,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
public void move(@NotNull MoverType movementType, @NotNull Vec3 movement) {
super.move(movementType, movement);
if (level() instanceof ServerLevel) {
if (lastTickSpeed < 0.3 || collisionCoolDown > 0
// TODO drone
// || this instanceof DroneEntity
) return;
if (lastTickSpeed < 0.3 || collisionCoolDown > 0 || this instanceof DroneEntity) return;
Entity driver = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_DRIVER_UUID));
if ((verticalCollision)) {

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.entity.vehicle.base;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
import com.atsuishio.superbwarfare.init.*;
@ -456,10 +457,7 @@ public abstract class VehicleEntity extends Entity {
public void onHurt(float pHealAmount, Entity attacker, boolean send) {
if (this.level() instanceof ServerLevel) {
var holder = Holder.direct(ModSounds.INDICATION_VEHICLE.get());
if (attacker instanceof ServerPlayer player && pHealAmount > 0 && this.getHealth() > 0
// TODO Drone
// && send && !(this instanceof DroneEntity)
) {
if (attacker instanceof ServerPlayer player && pHealAmount > 0 && this.getHealth() > 0 && send && !(this instanceof DroneEntity)) {
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getEyeY(), player.getZ(), 0.25f + (2.75f * pHealAmount / getMaxHealth()), random.nextFloat() * 0.1f + 0.9f, player.level().random.nextLong()));
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(3, 5));
}

View file

@ -1533,7 +1533,7 @@ public class ClientEventHandler {
List<Entity> entities = SeekTool.seekLivingEntities(villager, villager.level(), 16, 120);
for (var e : entities) {
if (e == player) {
// TODO aimVillager
// TODO aim villager msg
// ModUtils.PACKET_HANDLER.sendToServer(new AimVillagerMessage(villager.getId()));
aimVillagerCountdown = 80;
break;

View file

@ -29,7 +29,7 @@ import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntit
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
public class ClientSoundHandler {
@SubscribeEvent
public static void handleClientTick(ClientTickEvent event) {
public static void handleClientTick(ClientTickEvent.Pre event) {
LocalPlayer player = Minecraft.getInstance().player;
if (player == null) return;

View file

@ -5,7 +5,6 @@ import com.atsuishio.superbwarfare.capability.player.PlayerVariable;
import com.atsuishio.superbwarfare.config.common.GameplayConfig;
import com.atsuishio.superbwarfare.config.server.MiscConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
import com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity;
@ -834,10 +833,10 @@ public class LivingEventHandler {
@SubscribeEvent
public static void onKnockback(LivingKnockBackEvent event) {
ICustomKnockback knockback = ICustomKnockback.getInstance(event.getEntity());
if (knockback.superbWarfare$getKnockbackStrength() >= 0) {
event.setStrength((float) knockback.superbWarfare$getKnockbackStrength());
}
// ICustomKnockback knockback = ICustomKnockback.getInstance(event.getEntity());
// if (knockback.superbWarfare$getKnockbackStrength() >= 0) {
// event.setStrength((float) knockback.superbWarfare$getKnockbackStrength());
// }
}
@SubscribeEvent

View file

@ -145,32 +145,31 @@ public class ModVillagers {
// 等级 4 交易
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2),
new ItemStack(ModItems.GRENADE_40MM.get(), 1), 16, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2),
// new ItemStack(ModItems.HAND_GRENADE.get(), 1), 16, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2),
// new ItemStack(ModItems.RGO_GRENADE.get(), 1), 16, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 3),
// new ItemStack(ModItems.MORTAR_SHELL.get(), 1), 16, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4),
// new ItemStack(ModItems.CLAYMORE_MINE.get(), 1), 16, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4),
// new ItemStack(ModItems.C4_BOMB.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2),
new ItemStack(ModItems.HAND_GRENADE.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 2),
new ItemStack(ModItems.RGO_GRENADE.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 3),
new ItemStack(ModItems.MORTAR_SHELL.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4),
new ItemStack(ModItems.CLAYMORE_MINE.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4),
new ItemStack(ModItems.C4_BOMB.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4),
new ItemStack(ModItems.ROCKET.get(), 1), 16, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.GRENADE_40MM.get(), 1),
new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f));
// TODO grenade, shell, claymore, c4
// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.HAND_GRENADE.get(), 1),
// new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.RGO_GRENADE.get(), 1),
// new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.MORTAR_SHELL.get(), 3),
// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.CLAYMORE_MINE.get(), 1),
// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));
// trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.C4_BOMB.get(), 1),
// new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.HAND_GRENADE.get(), 1),
new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.RGO_GRENADE.get(), 1),
new ItemStack(Items.EMERALD, 1), 32, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.MORTAR_SHELL.get(), 3),
new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.CLAYMORE_MINE.get(), 1),
new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.C4_BOMB.get(), 1),
new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));
trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.ROCKET.get(), 1),
new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f));

View file

@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.capability.ModCapabilities;
import com.atsuishio.superbwarfare.client.renderer.item.Ntw20Renderer;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModRarity;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -35,10 +36,7 @@ public class Ntw20Item extends GunItem implements GeoItem {
public static ItemDisplayContext transformType;
public Ntw20Item() {
super(new Properties().stacksTo(1)
// TODO rarity
// .rarity(ModRarity.getLegendary())
);
super(new Properties().stacksTo(1).rarity(ModRarity.getLegendary()));
}
@Override

View file

@ -4,8 +4,11 @@ import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.capability.ModCapabilities;
import com.atsuishio.superbwarfare.client.renderer.item.JavelinItemRenderer;
import com.atsuishio.superbwarfare.client.tooltip.component.LauncherImageComponent;
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModRarity;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -21,10 +24,12 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.animal.Pig;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.ItemDisplayContext;
@ -52,10 +57,7 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
public static ItemDisplayContext transformType;
public JavelinItem() {
super(new Properties().stacksTo(1)
// TODO rarity
// .rarity(ModRarity.getLegendary())
);
super(new Properties().stacksTo(1).rarity(ModRarity.getLegendary()));
}
@Override
@ -137,13 +139,12 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
List<Entity> decoy = SeekTool.seekLivingEntities(player, player.level(), 512, 8);
for (var e : decoy) {
// todo flare decoy
// if (e instanceof FlareDecoyEntity flareDecoy) {
// tag.putString("TargetEntity", flareDecoy.getStringUUID());
// tag.putDouble("TargetPosX", flareDecoy.getX());
// tag.putDouble("TargetPosY", flareDecoy.getEyeY());
// tag.putDouble("TargetPosZ", flareDecoy.getZ());
// }
if (e instanceof FlareDecoyEntity flareDecoy) {
tag.putString("TargetEntity", flareDecoy.getStringUUID());
tag.putDouble("TargetPosX", flareDecoy.getX());
tag.putDouble("TargetPosY", flareDecoy.getEyeY());
tag.putDouble("TargetPosZ", flareDecoy.getZ());
}
}
Entity targetEntity = EntityFindUtil.findEntity(player.level(), tag.getString("TargetEntity"));
@ -153,10 +154,9 @@ public class JavelinItem extends GunItem implements GeoItem, SpecialFireWeapon {
if (tag.getInt("GuideType") == 0) {
if (seekingEntity != null && seekingEntity == targetEntity) {
tag.putInt("SeekTime", tag.getInt("SeekTime") + 1);
// TODO vehicle
// if (tag.getInt("SeekTime") > 0 && (!seekingEntity.getPassengers().isEmpty() || seekingEntity instanceof VehicleEntity) && seekingEntity.tickCount % 3 == 0) {
// seekingEntity.level().playSound(null, seekingEntity.getOnPos(), seekingEntity instanceof Pig ? SoundEvents.PIG_HURT : ModSounds.LOCKING_WARNING.get(), SoundSource.PLAYERS, 1, 1f);
// }
if (tag.getInt("SeekTime") > 0 && (!seekingEntity.getPassengers().isEmpty() || seekingEntity instanceof VehicleEntity) && seekingEntity.tickCount % 3 == 0) {
seekingEntity.level().playSound(null, seekingEntity.getOnPos(), seekingEntity instanceof Pig ? SoundEvents.PIG_HURT : ModSounds.LOCKING_WARNING.get(), SoundSource.PLAYERS, 1, 1f);
}
} else {
tag.putInt("SeekTime", 0);
}

View file

@ -7,6 +7,7 @@ import com.atsuishio.superbwarfare.client.tooltip.component.SecondaryCataclysmIm
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModRarity;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.item.gun.SpecialFireWeapon;
@ -44,10 +45,7 @@ public class SecondaryCataclysm extends GunItem implements GeoItem, SpecialFireW
public static ItemDisplayContext transformType;
public SecondaryCataclysm() {
super(new Properties().stacksTo(1).fireResistant()
// TODO rarity
// .rarity(ModRarity.getLegendary())
);
super(new Properties().stacksTo(1).fireResistant().rarity(ModRarity.getLegendary()));
}
@Override

View file

@ -3,10 +3,7 @@ package com.atsuishio.superbwarfare.item.gun.machinegun;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.renderer.item.MinigunItemRenderer;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModParticleTypes;
import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.tools.GunsTool;
@ -41,10 +38,7 @@ public class MinigunItem extends GunItem implements GeoItem {
public static ItemDisplayContext transformType;
public MinigunItem() {
super(new Properties().stacksTo(1)
// TODO rarity
// .rarity(ModRarity.getLegendary())
);
super(new Properties().stacksTo(1).rarity(ModRarity.getLegendary()));
}
@Override

View file

@ -4,10 +4,7 @@ import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.renderer.item.Aa12ItemRenderer;
import com.atsuishio.superbwarfare.client.tooltip.component.ShotgunImageComponent;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModPerks;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.gun.GunItem;
import com.atsuishio.superbwarfare.perk.Perk;
import com.atsuishio.superbwarfare.perk.PerkHelper;
@ -38,10 +35,7 @@ public class Aa12Item extends GunItem implements GeoItem {
public static ItemDisplayContext transformType;
public Aa12Item() {
super(new Properties().stacksTo(1)
// TODO rarity
// .rarity(ModRarity.getLegendary())
);
super(new Properties().stacksTo(1).rarity(ModRarity.getLegendary()));
}
@Override

View file

@ -5,6 +5,7 @@ import com.atsuishio.superbwarfare.client.renderer.item.SentinelItemRenderer;
import com.atsuishio.superbwarfare.client.tooltip.component.SentinelImageComponent;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModRarity;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -43,10 +44,7 @@ public class SentinelItem extends GunItem implements GeoItem {
public static ItemDisplayContext transformType;
public SentinelItem() {
super(new Properties().stacksTo(1)
// todo rarity
// .rarity(ModRarity.getLegendary())
);
super(new Properties().stacksTo(1).rarity(ModRarity.getLegendary()));
this.energyCapacity = () -> 24000;
}

View file

@ -0,0 +1,28 @@
package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
@Mixin(LivingEntity.class)
public class LivingEntityMixin implements ICustomKnockback {
@Unique
private double superbwarfare$knockbackStrength = -1;
@Override
public void superbWarfare$setKnockbackStrength(double strength) {
this.superbwarfare$knockbackStrength = strength;
}
@Override
public void superbWarfare$resetKnockbackStrength() {
this.superbwarfare$knockbackStrength = -1;
}
@Override
public double superbWarfare$getKnockbackStrength() {
return this.superbwarfare$knockbackStrength;
}
}

View file

@ -8,6 +8,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.util.RandomSource;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
@ -19,8 +21,9 @@ import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.event.entity.living.LivingDamageEvent;
import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent;
import net.neoforged.neoforge.event.entity.living.MobEffectEvent;
import net.neoforged.neoforge.event.tick.EntityTickEvent;
import net.neoforged.neoforge.network.PacketDistributor;
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME)
@ -109,19 +112,18 @@ public class ShockMobEffect extends MobEffect {
}
}
// TODO tick event?
// @SubscribeEvent
// public static void onLivingTick(LivingEvent.LivingTickEvent event) {
// LivingEntity living = event.getEntity();
//
// if (living.hasEffect(ModMobEffects.SHOCK)) {
// living.setXRot((float) Mth.nextDouble(RandomSource.create(), -23, -36));
// living.xRotO = living.getXRot();
// }
// }
@SubscribeEvent
public static void onLivingTick(EntityTickEvent.Pre event) {
if (!(event.getEntity() instanceof LivingEntity living)) return;
if (living.hasEffect(ModMobEffects.SHOCK)) {
living.setXRot((float) Mth.nextDouble(RandomSource.create(), -23, -36));
living.xRotO = living.getXRot();
}
}
@SubscribeEvent
public static void onEntityAttacked(LivingDamageEvent.Pre event) {
public static void onEntityAttacked(LivingIncomingDamageEvent event) {
if (event == null) return;
DamageSource source = event.getSource();
@ -129,8 +131,7 @@ public class ShockMobEffect extends MobEffect {
if (entity == null) return;
if (entity instanceof LivingEntity living && living.hasEffect(ModMobEffects.SHOCK)) {
// TODO how to cancel?
// event.setCanceled(true);
event.setCanceled(true);
}
}
}

View file

@ -6,12 +6,9 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import org.jetbrains.annotations.NotNull;
@EventBusSubscriber(modid = Mod.MODID, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
public record ShakeClientMessage(
double time, double radius, double amplitude,
double x, double y, double z

View file

@ -3,7 +3,9 @@
"package": "com.atsuishio.superbwarfare.mixins",
"compatibilityLevel": "JAVA_21",
"refmap": "mixins.superbwarfare.refmap.json",
"mixins": [],
"mixins": [
"LivingEntityMixin"
],
"client": [],
"minVersion": "0.8",
"injectors": {