more particles & config
This commit is contained in:
parent
d812e54058
commit
db66c68d4c
@ -38,7 +38,7 @@ mod_name=Enhanced Explosives
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=0.7.0
|
||||
mod_version=0.7.1
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.jenny.enhancedexplosives;
|
||||
|
||||
import com.jenny.enhancedexplosives.blocks.blocks;
|
||||
import com.jenny.enhancedexplosives.config.ConfigClient;
|
||||
import com.jenny.enhancedexplosives.entities.entities;
|
||||
import com.jenny.enhancedexplosives.items.items;
|
||||
import com.mojang.logging.LogUtils;
|
||||
@ -9,7 +10,9 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
@ -19,9 +22,7 @@ import org.slf4j.Logger;
|
||||
@Mod(EnhancedExplosives.MODID)
|
||||
public class EnhancedExplosives {
|
||||
|
||||
// Define mod id in a common place for everything to reference
|
||||
public static final String MODID = "enhancedexplosives";
|
||||
// Directly reference a slf4j logger
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public EnhancedExplosives() {
|
||||
@ -36,6 +37,7 @@ public class EnhancedExplosives {
|
||||
|
||||
// Register ourselves for server and other game events we are interested in
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, ConfigClient.SPEC);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.jenny.enhancedexplosives.config;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
|
||||
import static com.jenny.enhancedexplosives.EnhancedExplosives.MODID;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class ConfigClient {
|
||||
private static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
|
||||
|
||||
private static final ForgeConfigSpec.ConfigValue<Boolean> C_ARROW_PARTICLES =
|
||||
BUILDER.comment("weather to spawn client-side particles for arrows")
|
||||
.define("arrowParticles", true);
|
||||
|
||||
public static final ForgeConfigSpec SPEC = BUILDER.build();
|
||||
|
||||
public static boolean ARROW_PARTICLES;
|
||||
|
||||
@SubscribeEvent
|
||||
static void onLoad(final ModConfigEvent event)
|
||||
{
|
||||
ARROW_PARTICLES = C_ARROW_PARTICLES.get();
|
||||
}
|
||||
}
|
@ -228,4 +228,8 @@ public class baseArrow extends AbstractArrow {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void spawnParticles() {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -42,4 +42,14 @@ public class concussiveArrow extends baseArrow{
|
||||
protected ItemStack getPickupItem() {
|
||||
return new ItemStack(items.CONCUSSIVE_ARROW.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticles() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class tntArrow extends baseArrow {
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (level().isClientSide()) {
|
||||
level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D);
|
||||
//spawnParticles();
|
||||
}
|
||||
if (this.inGround) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
@ -31,6 +31,16 @@ public class tntArrow extends baseArrow {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticles() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
double x = getX() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double y = getY() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
double z = getZ() + (double) level().getRandom().nextInt(-10, 11) / 10;
|
||||
level().addParticle(ParticleTypes.WAX_ON, x, y, z, this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPostHurtEffects(@NotNull LivingEntity pTarget) {
|
||||
this.level().explode(this, this.getX(), this.getY(), this.getZ(), 2, Level.ExplosionInteraction.TNT);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.jenny.enhancedexplosives.entities.client;
|
||||
|
||||
import com.jenny.enhancedexplosives.entities.arrows.baseArrow;
|
||||
import com.jenny.enhancedexplosives.config.*;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
@ -15,6 +17,7 @@ import net.minecraft.world.level.block.Blocks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
|
||||
private final boolean renderParticles = ConfigClient.ARROW_PARTICLES;
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
private float i = 0;
|
||||
|
||||
@ -32,6 +35,9 @@ public class TNTArrowRenderer extends EntityRenderer<baseArrow> {
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(-90.0F));
|
||||
pPoseStack.translate(-0.5F, -0.5F, 0.5F);
|
||||
pPoseStack.mulPose(Axis.YP.rotationDegrees(90.0F));
|
||||
if (renderParticles) {
|
||||
pEntity.spawnParticles();
|
||||
}
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.TNT.defaultBlockState(), pPoseStack, pBuffer, pPackedLight, Math.round(Math.sin(i)) == 0);
|
||||
pPoseStack.popPose();
|
||||
super.render(pEntity, pEntityYaw, pPartialTicks, pPoseStack, pBuffer, pPackedLight);
|
||||
|
Loading…
x
Reference in New Issue
Block a user