修复rpk栓不动,M60的换弹问题
This commit is contained in:
parent
4dfcffc9bd
commit
2f0e39e54c
5 changed files with 27 additions and 22 deletions
|
@ -14,8 +14,8 @@ import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
|||
public class M4Layer extends GeoRenderLayer<M4Item> {
|
||||
private static final ResourceLocation LAYER = new ResourceLocation("target", "textures/item/m4_e.png");
|
||||
|
||||
public M4Layer(GeoRenderer<M4Item> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
public M4Layer(GeoRenderer<M4Item> itemGeoRenderer) {
|
||||
super(itemGeoRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -107,6 +107,8 @@ public class RpkItemModel extends GeoModel<RpkItem> {
|
|||
}
|
||||
}
|
||||
|
||||
shuan.setPosZ(2.4f * (float) fp);
|
||||
|
||||
if (stack.getOrCreateTag().getDouble("flash_time") > 0) {
|
||||
flare.setScaleX((float) (1.0 + 0.5 * (Math.random() - 0.5)));
|
||||
flare.setScaleY((float) (1.0 + 0.5 * (Math.random() - 0.5)));
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.world.level.gameevent.GameEvent;
|
|||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.*;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.entity.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.entity.PartEntity;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
@ -273,27 +274,11 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
|
||||
protected void onProjectileTick() {
|
||||
}
|
||||
|
||||
protected void onHitBlock(Vec3 location) {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
if (this.beast) {
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.END_ROD, location.x, location.y, location.z, 15, 0.1, 0.1, 0.1, 0.05, true);
|
||||
} else {
|
||||
ParticleTool.sendParticle(serverLevel, TargetModParticleTypes.BULLET_HOLE.get(), location.x, location.y, location.z, 1, 0, 0, 0, 0, true);
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.SMOKE, location.x, location.y, location.z, 3, 0, 0.1, 0, 0.01, true);
|
||||
|
||||
this.discard();
|
||||
}
|
||||
serverLevel.playSound(null, new BlockPos((int) location.x, (int) location.y, (int) location.z), TargetModSounds.LAND.get(), SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private void onHit(HitResult result) {
|
||||
if (result instanceof BlockHitResult blockHitResult) {
|
||||
if (blockHitResult.getType() == HitResult.Type.MISS) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 hitVec = result.getLocation();
|
||||
this.onHitBlock(hitVec);
|
||||
}
|
||||
|
@ -315,6 +300,21 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
}
|
||||
}
|
||||
|
||||
protected void onHitBlock(Vec3 location) {
|
||||
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
if (this.beast) {
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.END_ROD, location.x, location.y, location.z, 15, 0.1, 0.1, 0.1, 0.05, true);
|
||||
} else {
|
||||
ParticleTool.sendParticle(serverLevel, TargetModParticleTypes.BULLET_HOLE.get(), location.x, location.y, location.z, 1, 0, 0, 0, 0, true);
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.SMOKE, location.x, location.y, location.z, 3, 0, 0.1, 0, 0.01, true);
|
||||
|
||||
this.discard();
|
||||
}
|
||||
serverLevel.playSound(null, new BlockPos((int) location.x, (int) location.y, (int) location.z), TargetModSounds.LAND.get(), SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
protected void onHitEntity(Entity entity, boolean headshot, boolean legshot) {
|
||||
if (entity == null) return;
|
||||
|
||||
|
|
|
@ -284,16 +284,16 @@ public class ClientEventHandler {
|
|||
data.putDouble("firetime", 0.02);
|
||||
data.putDouble("fire_rotx_time", 0.02);
|
||||
if (data.getDouble("firepos2") < 0.6) {
|
||||
data.putDouble("firepos2", (data.getDouble("firepos2") + 0.04 * times));
|
||||
data.putDouble("firepos2", (data.getDouble("firepos2") + 0.06 * times));
|
||||
}
|
||||
}
|
||||
if (0 < data.getDouble("firepos2")) {
|
||||
data.putDouble("firepos2", (data.getDouble("firepos2") - 0.01 * times));
|
||||
data.putDouble("firepos2", (data.getDouble("firepos2") - 0.015 * times));
|
||||
} else {
|
||||
data.putDouble("firepos2", 0);
|
||||
}
|
||||
if (0 < data.getDouble("firetime")) {
|
||||
data.putDouble("firetime", (data.getDouble("firetime") + 0.12 * (1.1 - data.getDouble("firetime")) * times));
|
||||
data.putDouble("firetime", (data.getDouble("firetime") + 0.18 * (1.1 - data.getDouble("firetime")) * times));
|
||||
}
|
||||
if (0 < data.getDouble("firetime") && data.getDouble("firetime") < 0.454) {
|
||||
data.putDouble("fire_pos",
|
||||
|
@ -307,7 +307,7 @@ public class ClientEventHandler {
|
|||
|
||||
|
||||
if (0 < data.getDouble("fire_rotx_time") && data.getDouble("fire_rotx_time") < 1.732) {
|
||||
data.putDouble("fire_rotx_time", (data.getDouble("fire_rotx_time") + 0.12 * (1.9 - data.getDouble("fire_rotx_time")) * times));
|
||||
data.putDouble("fire_rotx_time", (data.getDouble("fire_rotx_time") + 0.18 * (1.9 - data.getDouble("fire_rotx_time")) * times));
|
||||
}
|
||||
|
||||
if (0 < data.getDouble("fire_rotx_time") && data.getDouble("fire_rotx_time") < 1.732) {
|
||||
|
|
|
@ -190,6 +190,9 @@ public class M60Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
SoundTool.playLocalSound(serverPlayer, TargetModSounds.M_60_RELOAD_NORMAL.get(), 100, 1);
|
||||
}
|
||||
}
|
||||
if (tag.getDouble("reload_time") <= 55) {
|
||||
tag.putDouble("empty", 0);
|
||||
}
|
||||
if (player.getMainHandItem().getItem() == itemStack.getItem()
|
||||
&& player.getMainHandItem().getOrCreateTag().getDouble("id") == id) {
|
||||
if (tag.getDouble("reload_time") > 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue