Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Starexify committed Oct 30, 2024
1 parent 2ec876c commit 4de6bca
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
}
],
"textures": {
"layer0": "nmt:item/lava_bottle"
"layer0": "nmt:item/lingering_lava_bottle"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
}
],
"textures": {
"layer0": "nmt:item/lava_bottle"
"layer0": "nmt:item/splash_lava_bottle"
}
}
17 changes: 12 additions & 5 deletions src/main/java/net/nova/nmt/data/NMTItemModelProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
import net.nova.nmt.init.NMTItems;
import net.nova.nmt.init.NMTPotions;

import java.util.Map;

import static net.nova.nmt.NoMoreThings.MODID;

public class NMTItemModelProvider extends ItemModelProvider {
public static final Map<String, Float> POTION_PREDICATES = Map.of(
"lava", 1.0f,
"awfully", 2.0f
);

public NMTItemModelProvider(PackOutput output, ExistingFileHelper existingFileHelper) {
super(output, MODID, existingFileHelper);
}
Expand Down Expand Up @@ -54,17 +61,17 @@ public void potionItem(Item item) {
default -> potion + "_potion";
};

float predicate = POTION_PREDICATES.getOrDefault(potion, 0.0f);

getBuilder(itemName).override()
.predicate(NMTItemProperties.potionTypePredicate, potionTypePredicate + 1.0f)
.model(new ModelFile.UncheckedModelFile(NoMoreThings.rl("item/" + potionName)))
.predicate(NMTItemProperties.potionTypePredicate, potionTypePredicate + predicate)
.model(new ModelFile.UncheckedModelFile(NoMoreThings.rl("item/" + prefix + potionName)))
.end();

// Create the individual potion model
getBuilder("item/" + potionName)
.parent(new ModelFile.UncheckedModelFile("item/generated"))
.texture("layer0", NoMoreThings.rl("item/" + potionName));

potionTypePredicate += 1.0f;
.texture("layer0", NoMoreThings.rl("item/" + prefix + potionName));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package net.nova.nmt.entity.projectile;

import net.minecraft.core.BlockPos;
import net.minecraft.core.component.DataComponents;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.AreaEffectCloud;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
Expand All @@ -9,8 +12,10 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.alchemy.PotionContents;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.HitResult;
import net.nova.nmt.init.NMTItems;
import net.nova.nmt.init.NMTPotions;

public class ThrownObsidianPotion extends ThrownPotion {
public ThrownObsidianPotion(EntityType<? extends ThrownPotion> entityType, Level level) {
Expand All @@ -30,9 +35,22 @@ protected void onHit(HitResult result) {
super.onHit(result);
if (!this.level().isClientSide) {
ItemStack itemstack = this.getItem();
BlockPos pos = this.blockPosition();
PotionContents potioncontents = itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
if (potioncontents.hasEffects()) {
if (this.isLingering()) {
if (potioncontents.is(NMTPotions.LAVA)) {
ServerLevel level = (ServerLevel) this.level();
level.sendParticles(
ParticleTypes.FLAME,
pos.getX(), pos.getY(), pos.getZ(),
50,
1.0,
0.5,
1.0,
0.1
);
}
this.makeAreaOfEffectCloud(potioncontents);
}

Expand All @@ -52,7 +70,7 @@ private void makeAreaOfEffectCloud(PotionContents potionContents) {
areaeffectcloud.setRadius(3.0F);
areaeffectcloud.setRadiusOnUse(-0.5F);
areaeffectcloud.setWaitTime(10);
areaeffectcloud.setRadiusPerTick(-areaeffectcloud.getRadius() / (float)areaeffectcloud.getDuration());
areaeffectcloud.setRadiusPerTick(-areaeffectcloud.getRadius() / (float) areaeffectcloud.getDuration());
areaeffectcloud.setPotionContents(potionContents);
this.level().addFreshEntity(areaeffectcloud);
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4de6bca

Please sign in to comment.