Skip to content

Commit

Permalink
Rewrite and rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Rin committed Oct 23, 2024
1 parent a12594d commit 6ba9a50
Show file tree
Hide file tree
Showing 63 changed files with 835 additions and 638 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ halplibe_version=4.1.3
terrain_api_version=1.4.4-7.2-pre1

# Mod
mod_version=1.0.9
mod_version=1.1.1
mod_group=Mizuri-n
mod_name=Better with Defense
mod_name=Rin's Fortress
4 changes: 0 additions & 4 deletions src/main/java/mizurin/shieldmod/IColorable.java

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/java/mizurin/shieldmod/IShieldZombie.java

This file was deleted.

52 changes: 0 additions & 52 deletions src/main/java/mizurin/shieldmod/ShieldAchievements.java

This file was deleted.

33 changes: 20 additions & 13 deletions src/main/java/mizurin/shieldmod/ShieldMod.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
package mizurin.shieldmod;

import com.mojang.nbt.CompoundTag;
import mizurin.shieldmod.entities.*;
import mizurin.shieldmod.item.ArmorColored;
import net.fabricmc.api.ModInitializer;
import net.minecraft.client.render.colorizer.Colorizers;
import net.minecraft.client.render.entity.ArmoredZombieRenderer;
import net.minecraft.client.render.entity.SnowballRenderer;
import net.minecraft.client.render.model.ModelZombie;
import net.minecraft.core.block.Block;
import net.minecraft.core.crafting.LookupFuelFurnace;
import net.minecraft.core.entity.SpawnListEntry;
import net.minecraft.core.data.registry.recipe.SearchQuery;
import net.minecraft.core.data.registry.recipe.entry.RecipeEntryCraftingDynamic;
import net.minecraft.core.enums.ArtType;
import net.minecraft.core.enums.EnumCreatureType;
import net.minecraft.core.item.Item;
import net.minecraft.core.item.ItemDye;
import net.minecraft.core.item.ItemStack;
import net.minecraft.core.net.entity.NetEntityHandler;
import net.minecraft.core.net.entity.entries.ArrowNetEntry;
import net.minecraft.core.world.biome.Biomes;
import net.minecraft.core.player.inventory.InventoryCrafting;
import net.minecraft.core.util.helper.Color;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import turniplabs.halplibe.helper.AchievementHelper;
import turniplabs.halplibe.helper.EntityHelper;
import turniplabs.halplibe.util.ClientStartEntrypoint;
import turniplabs.halplibe.util.ConfigHandler;
import turniplabs.halplibe.util.GameStartEntrypoint;
import mizurin.shieldmod.item.Shields;

import java.util.Properties;
import java.util.*;

public class ShieldMod implements ModInitializer, GameStartEntrypoint, ClientStartEntrypoint{
public static final String MOD_ID = "shieldmod";
Expand All @@ -32,22 +34,25 @@ public class ShieldMod implements ModInitializer, GameStartEntrypoint, ClientSta

public static int itemID;
public static int entityID;
public static boolean hurtSound;
public static ArtType paintingSeal;
public static ArtType paintingRice;
static {
Properties prop = new Properties();
prop.setProperty("starting_item_id", "21000");
prop.setProperty("starting_entity_id", "100");
prop.setProperty("enable_hit_sounds", "false");
ConfigHandler config = new ConfigHandler(ShieldMod.MOD_ID, prop);
itemID = config.getInt("starting_item_id");
entityID = config.getInt("starting_entity_id");
hurtSound = config.getBoolean("enable_hit_sounds");
config.updateConfig();
}


@Override
public void onInitialize() {
LOGGER.info("Better with Defense has been initialized!");
LOGGER.info("Rin's Fortress has been initialized.");
new Shields().initializeItems();
Colorizers.registerColorizers();
}
Expand All @@ -59,19 +64,18 @@ public void beforeGameStart() {
EntityHelper.createEntity(EntityShield.class, entityID, "ammoShield", () -> new SnowballRenderer(Shields.ammotearShield));
EntityHelper.createEntity(EntityPB.class, ++entityID, "poisonBottle", () -> new SnowballRenderer(Shields.poisonBottle));
EntityHelper.createEntity(EntityRock.class, ++entityID, "pebbleShield", () -> new SnowballRenderer(Item.ammoPebble));
//AchievementPage SHIELDACHIEVEMENTS;
//SHIELDACHIEVEMENTS = new ShieldAchievements();
AchievementHelper.addPage(new ShieldAchievements());
EntityHelper.createEntity(EntityFire.class, ++entityID, "entityFire", () -> new SnowballRenderer(Block.fire.asItem()));

NetEntityHandler.registerNetworkEntry(new NetShieldEntry(), 8000);
NetEntityHandler.registerNetworkEntry(new NetPotionEntry(), 8001);
NetEntityHandler.registerNetworkEntry(new NetFireEntry(), 8002);
}

@Override
public void afterGameStart() {
LookupFuelFurnace.instance.addFuelEntry(Shields.woodenShield.id, 600);
new recipes().initializeRecipe();
LOGGER.info("BWD initialized");
LOGGER.info("RF initialized");
}

@Override
Expand All @@ -81,4 +85,7 @@ public void beforeClientStart() {
@Override
public void afterClientStart() {
}



}
142 changes: 0 additions & 142 deletions src/main/java/mizurin/shieldmod/armorRecipeColor.java

This file was deleted.

72 changes: 72 additions & 0 deletions src/main/java/mizurin/shieldmod/entities/EntityFire.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package mizurin.shieldmod.entities;
import net.minecraft.core.HitResult;
import net.minecraft.core.entity.EntityLiving;
import net.minecraft.core.entity.player.EntityPlayer;
import net.minecraft.core.entity.projectile.EntityProjectile;
import net.minecraft.core.item.Item;
import net.minecraft.core.util.helper.DamageType;
import net.minecraft.core.util.phys.Vec3d;
import net.minecraft.core.world.World;

public class EntityFire extends EntityProjectile {
public EntityFire(World world, EntityLiving entityliving){
super(world, entityliving);
this.modelItem = Item.ammoFireball;
}
public EntityFire(World world, double d, double d1, double d2){
super(world, d, d1, d2);
this.modelItem = Item.ammoFireball;
}

public void init() {
this.damage = 6;
this.defaultGravity = 0.003F;
this.defaultProjectileSpeed = 0.15F;
}

public void onHit(HitResult hitResult) {
if (hitResult.hitType == HitResult.HitType.ENTITY && hitResult.entity != this.owner) {
hitResult.entity.hurt(this.owner, this.damage, DamageType.FIRE);

hitResult.entity.xd *= .33;
hitResult.entity.yd = 0.0;
hitResult.entity.zd *= .33;

hitResult.entity.remainingFireTicks = 300;
if (hitResult.entity instanceof EntityPlayer){
remove();
}
}

}

@Override
protected void checkOnWater(boolean addVelocity) {
if (this.checkAndHandleWater(addVelocity)) {
this.remove();
}
}

@Override
public void tick() {
super.tick();

this.xd *= 7.5;
this.yd *= 7.5;
this.zd *= 7.5;

if(this.tickCount > 8){
this.remove();
}
if(this.tickCount > 1) {
world.spawnParticle("flame", this.x, this.y, this.z, this.random.nextFloat()*.1, this.random.nextFloat()*.1, this.random.nextFloat()*.1, 0);
}
}
@Override
public HitResult getHitResult() {
Vec3d currentPos = Vec3d.createVector(this.x, this.y, this.z);
Vec3d nextPos = Vec3d.createVector(this.x + this.xd, this.y + this.yd - 0.25, this.z + this.zd);
HitResult hit = this.world.checkBlockCollisionBetweenPoints(currentPos, nextPos, false, true);
return hit;
}
}
Loading

0 comments on commit 6ba9a50

Please sign in to comment.