
hammy3502
Members-
Content Count
17 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout hammy3502
-
Rank
Tree Puncher
-
Was able to figure it out! For those stumbling across this, you need to Override the isEquivalentTo method in your fluid class to return true if the fluidIn matches your still fluid or your flowing fluid.
-
Hello! I'm currently trying to add a custom fluid, however it seems to flow extremely weirdly. The source block only flows to some sides some of the time, and flowing blocks don't produce more flowing blocks of a lower level, and instead dissipate as if there were no source block! Any help would be greatly appreciated! MoltenSyrup.java public class MoltenSyrup extends FlowingFluid { @Override public Fluid getFlowingFluid() { return ModFluids.moltenSyrupFlowing.get(); } @Override public Fluid getStillFluid() { return ModFluids.moltenSyrup.get(); } @Override public boolean canSourcesMultiply() { return true; } @Override public void beforeReplacingBlock(IWorld worldIn, BlockPos pos, BlockState state) { worldIn.playEvent(1501, pos, 0); } @Override public int getSlopeFindDistance(IWorldReader worldIn) { return 4; } @Override public int getLevelDecreasePerBlock(IWorldReader worldIn) { return 1; } @Override public Item getFilledBucket() { return ModItems.moltenSyrupBucket.get(); } @Override public boolean canDisplace(FluidState fluidState, IBlockReader blockReader, BlockPos pos, Fluid fluid, Direction direction) { return false; } @Override public int getTickRate(IWorldReader p_205569_1_) { return 60; // Moves very slow, it's syrup after all. } @Override public float getExplosionResistance() { return 100.0F; } @Override public BlockState getBlockState(FluidState state) { return ModBlocks.moltenSyrupBlock.getBlock().get().getDefaultState() .with(FlowingFluidBlock.LEVEL, Integer.valueOf(getLevelFromState(state))); } @Override public boolean isSource(FluidState state) { return true; } @Override public int getLevel(FluidState state) { return 8; } @Override public FluidAttributes createAttributes() { return net.minecraftforge.fluids.FluidAttributes.builder( new ResourceLocation("block/molten_syrup_still"), new ResourceLocation("block/molten_syrup_flow")) .translationKey("block.survival_extras_2.molten_syrup") .luminosity(4).density(3000).viscosity(12000).temperature(775) .sound(SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundEvents.ITEM_BUCKET_EMPTY_LAVA) .build(this); } public static class Flowing extends MoltenSyrup { protected void fillStateContainer(StateContainer.Builder<Fluid, FluidState> builder) { super.fillStateContainer(builder); builder.add(LEVEL_1_8); } public int getLevel(FluidState state) { return state.get(LEVEL_1_8); } public boolean isSource(FluidState state) { return false; } } public static class Source extends MoltenSyrup { public int getLevel(FluidState state) { return 8; } public boolean isSource(FluidState state) { return true; } } } Full repo is at https://github.com/hammy3502/survival-extras-2 Thank you for any help!
-
Hello! I'm currently trying to add a custom brewing stand recipe, however it seems to output the wrong potion! Instead of giving me the extended levitation potion, it's giving me the extended jumpless potion. ModPotions.java public class ModPotions { public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, SurvivalExtras2.MOD_ID); public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, SurvivalExtras2.MOD_ID); private static ArrayList<BrewingRecipe> recipes = new ArrayList<>(); public static final RegistryObject<Effect> milkEffect = EFFECTS.register("milk", () -> new EffectMilk(EffectType.NEUTRAL, 0xFFFFFF)); public static final RegistryObject<Potion> milkPotion = POTIONS.register("milk_potion", () -> new Potion(new EffectInstance(milkEffect.get()))); public static final RegistryObject<Effect> starEffect = EFFECTS.register("star", () -> new EffectStar(EffectType.BENEFICIAL, 0xFFFF00)); public static final RegistryObject<Potion> baseStarPotion = POTIONS.register("base_star", () -> new Potion(new EffectInstance(starEffect.get(), 400, 0))); public static final RegistryObject<Effect> burntEffect = EFFECTS.register("burnt", () -> new EffectBlank(EffectType.HARMFUL, 0x1f1f1f)); public static final RegistryObject<Effect> challengeEffect = EFFECTS.register("food_kingdom_challenge", () -> new EffectChallenge(EffectType.BENEFICIAL, 0xFFFF00)); public static final RegistryObject<Effect> jumpless = EFFECTS.register("jumpless", () -> new EffectBlank(EffectType.HARMFUL, 0xDD00B3)); public static final RegistryObject<Potion> jumplessPotion = POTIONS.register("base_jumpless", () -> new Potion(new EffectInstance(jumpless.get(), 45*20))); public static final RegistryObject<Potion> jumplessPotionExtended = POTIONS.register("jumpless_extended", () -> new Potion(new EffectInstance(jumpless.get(), 90*20))); public static final RegistryObject<Potion> mysteriousPotion = POTIONS.register("se2_mysterious", Potion::new); public static final RegistryObject<Potion> levitationBase = POTIONS.register("base_levitation", () -> new Potion(new EffectInstance(Effects.LEVITATION, 90*20))); public static final RegistryObject<Potion> levitationExtended = POTIONS.register("levitation_extended", () -> new Potion(new EffectInstance(Effects.LEVITATION, 180*20))); public static final RegistryObject<Potion> levitationExtra = POTIONS.register("levitation_extra", () -> new Potion(new EffectInstance(Effects.LEVITATION, 45*20, 1))); public static void addRecipes(FMLCommonSetupEvent event) { initRecipes(); for (BrewingRecipe recipe : recipes) { event.enqueueWork(() -> BrewingRecipeRegistry.addRecipe(recipe)); } } public static void initRecipes() { addAwkwardRecipe(Items.MILK_BUCKET, milkPotion.get()); addAwkwardRecipe(ModItems.mysteriousCore.get(), mysteriousPotion.get()); addAwkwardRecipe(ModItems.flightEssence.get(), levitationBase.get()); addMysteriousRecipe(Items.NETHER_STAR, baseStarPotion.get()); addMysteriousRecipe(Items.RABBIT_FOOT, jumplessPotion.get()); addWaterRecipe(ModItems.enchantIngot.get(), new ItemStack(Items.EXPERIENCE_BOTTLE)); addRedstoneRecipe(jumplessPotion.get(), jumplessPotionExtended.get()); addRedstoneRecipe(levitationBase.get(), levitationExtended.get()); addGlowstoneRecipe(levitationBase.get(), levitationExtra.get()); } public static void addAwkwardRecipe(Item ingredient, Potion potion) { recipes.add(new BrewingRecipe( Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.AWKWARD)), Ingredient.fromItems(ingredient), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potion))); } public static void addMysteriousRecipe(Item ingredient, Potion potion) { recipes.add(new BrewingRecipe( Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), ModPotions.mysteriousPotion.get())), Ingredient.fromItems(ingredient), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potion))); } public static void addWaterRecipe(Item ingredient, ItemStack output) { recipes.add(new BrewingRecipe( Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), Potions.WATER)), Ingredient.fromItems(ingredient), output )); } public static void addRedstoneRecipe(Potion potionIn, Potion potionOut) { recipes.add(new BrewingRecipe( Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionIn)), Ingredient.fromItems(Items.REDSTONE), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionOut))); } public static void addGlowstoneRecipe(Potion potionIn, Potion potionOut) { recipes.add(new BrewingRecipe( Ingredient.fromStacks(PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionIn)), Ingredient.fromItems(Items.GLOWSTONE_DUST), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTION), potionOut))); } } Full repo is at https://github.com/hammy3502/survival-extras-2 if you need to look anywhere else. Thank you so much for any help!
-
[1.16.4] Can't Set ItemTier Material to Custom
hammy3502 replied to hammy3502's topic in Modder Support
I'm stupid, the RegistryObject's are suppliers. Swapping those in, and changing the code around a bit, and everything works now. Thank you so much for the help! -
[1.16.4] Can't Set ItemTier Material to Custom
hammy3502 replied to hammy3502's topic in Modder Support
I've put a quick temporary patch on registerTools to return a boolean, and simply register the items necessary without calling .get(), though the crash still occurs on the repairMaterial, as I'm not sure how to pass in a proper Supplier. -
[1.16.4] Can't Set ItemTier Material to Custom
hammy3502 replied to hammy3502's topic in Modder Support
Hello, and thank you so much for the help! I know it may not be clear from the code above, but the items are currently registered through the DeferredRegister. How would I go about getting the supplier for foodariumIngot? Just passing in the foodariumIngot is a RegistryObject<Item>, but I need a Supplier<Item>. Thank you so much for any help! -
[1.16.4] Can't Set ItemTier Material to Custom
hammy3502 replied to hammy3502's topic in Modder Support
Hello, and thank you for the help so far! It seems in 1.16, LazyLoadBase was moved to LazyValue, but even with that, it sadly still seems to crash. Tool Creation: public static final Item[] foodariumTools = ModToolsArmor.registerTools("foodarium", 2, 777, 8.0F, 2.5F, 16, -3.05F, ModItems.foodariumIngot.get()); Start of registerTools (rest of it is the same): public static Item[] registerTools(String materialName, int harvestLevel, int maxUses, float miningSpeed, float attackDamageExtraFromWood, int enchantability, float axeAttackSpeed, Item repairMaterial) { Item[] tools = new Item[5]; ModItemTier itemTier = new ModItemTier(harvestLevel, maxUses, miningSpeed, attackDamageExtraFromWood, enchantability, () -> Ingredient.fromItems(repairMaterial)); Modified ItemTier: public class ModItemTier implements IItemTier { private final int harvestLevel; private final int maxUses; private final float miningSpeed; private final float attackDamageExtraFromWood; private final int enchantability; private final LazyValue<Ingredient> repairMaterial; public ModItemTier(int harvestLevel, int maxUses, float miningSpeed, float attackDamageExtraFromWood, int enchantability, Supplier<Ingredient> repairMaterial) { this.harvestLevel = harvestLevel; this.maxUses = maxUses; this.miningSpeed = miningSpeed; this.attackDamageExtraFromWood = attackDamageExtraFromWood; this.repairMaterial = new LazyValue<>(repairMaterial); this.enchantability = enchantability; } @Override public int getMaxUses() { return this.maxUses; } @Override public float getEfficiency() { return this.miningSpeed; } @Override public float getAttackDamage() { return this.attackDamageExtraFromWood; } @Override public int getHarvestLevel() { return this.harvestLevel; } @Override public int getEnchantability() { return this.enchantability; } @Override public Ingredient getRepairMaterial() { return this.repairMaterial.getValue(); } } New Crash Log (seems to have the same error as before): https://pastebin.com/PSDVZaDE Thank you again for all the help so far! -
Hello! I'm currently trying to set my ItemTier's repair material to be an item that I've added to the game, so that it can be used in an anvil. However, I seem to run into a problem where it fails to add as the registry for the repair item hasn't taken place yet! However, I'm not sure how I could fix this, as I need to register the ToolItems at some point. Here's the code I've written: Repair Material: public static final RegistryObject<Item> foodariumIngot = ITEMS.register("foodarium_ingot", () -> new Item(new Item.Properties().group(SurvivalExtras2.CreativeGroup))); Tool Creation: public static final Item[] foodariumTools = ModToolsArmor.registerTools("foodarium", 2, 777, 8.0F, 2.5F, 16, -3.05F, ModItems.foodariumIngot.get()); ModToolsArmor.registerTools() function: public static Item[] registerTools(String materialName, int harvestLevel, int maxUses, float miningSpeed, float attackDamageExtraFromWood, int enchantability, float axeAttackSpeed, Item repairMaterial) { Item[] tools = new Item[5]; ModItemTier itemTier = new ModItemTier(harvestLevel, maxUses, miningSpeed, attackDamageExtraFromWood, enchantability, repairMaterial); tools[0] = ModItems.ITEMS.register(materialName + "_sword", () -> new SwordItem(itemTier, 4, -2.4F, new Item.Properties().group(SurvivalExtras2.CreativeGroup)) ).get(); tools[1] = ModItems.ITEMS.register(materialName + "_pickaxe", () -> new PickaxeItem(itemTier, 1, -2.8F, new Item.Properties().group(SurvivalExtras2.CreativeGroup)) ).get(); tools[2] = ModItems.ITEMS.register(materialName + "_axe", () -> new PickaxeItem(itemTier, 5, axeAttackSpeed, new Item.Properties().group(SurvivalExtras2.CreativeGroup)) ).get(); tools[3] = ModItems.ITEMS.register(materialName + "_shovel", () -> new ShovelItem(itemTier, 1.5F, -3.0F, new Item.Properties().group(SurvivalExtras2.CreativeGroup)) ).get(); tools[4] = ModItems.ITEMS.register(materialName + "_shovel", () -> new HoeItem(itemTier, -3, 0.0F, new Item.Properties().group(SurvivalExtras2.CreativeGroup)) ).get(); return tools; } Thank you so much for any help! EDIT: Crash log: https://pastebin.com/s9N9Qur6
-
[1.16.4] Dealing with EntityType Shennanigans
hammy3502 replied to hammy3502's topic in Modder Support
Thank you so much for all the help! I moved all the entities over to use the DeferredRegister system, and my entities are all working well! -
[1.16.4] Dealing with EntityType Shennanigans
hammy3502 replied to hammy3502's topic in Modder Support
Hello, and thank you for the help! I think I'm wrapping my mind around the functions in IEntityAdditionalSpawnData, and I know I can pass the data around from there throughout the Entity class, but I'm wondering how I can get that data into the super() constructor of the entity considering the fact that Java prevents referencing "this" until after calling super(), and super() is where it fails. As for the registration stuff, I'm quite confused on. I'm listening for RegistryEvent.Register<EntityType<?>> event and registering there, and looking at the Forge Docs, if I understand them correctly, @ObjectHolder looks to be for already-registered objects. I'm sure I definitely don't understand this properly, I'm just confused as to how to proceed. Thank you for all the help so far! EDIT: Figured out how to get ahold of the data in the constructor (I used spawnEntity.getAdditionalData()) -
[1.16.4] Dealing with EntityType Shennanigans
hammy3502 replied to hammy3502's topic in Modder Support
Hello, and thank you for the help! I will definitely look into the incorrect registration, it looks like I'm using register() instead of registerAll() (though I should probably figure out how to use the deferred register for EntityTypes). The Entity doesn't spawn on the client due to passing null in for the shooter, causing the game to fail on getting the shooter's position. What I'm stuck on is how to get a valid shooter from item.PancakeBow over to entity.PancakeProjectile. What would be the best way of going about doing this? Thank you again for any help! I'll have the registration fixed as soon as I can, though I'm able to get the entity in the game (see it in /summon's TAB completion with my modid). -
I'm currently working on porting a mod from 1.12 to 1.16. Back in 1.12, summoning entities was seemingly quite easy, where I could create my entity object, then call world.addEntity(entity), and it would take my entity object and summon it in. Now it seems in the land of 1.16, that as a result of the EntityType system(?), world.addEntity(entity) seems to completely ignore the fact I've already created an instance of my entity object and tries to make a new one using the factory. Problematically for me, I'm trying to make an entity that extends AbstractFireballEntity (as I want it to act similarly to a fireball, just with different behavior on hit, and a couple cosmetic changes) which requires me to pass in a shooter to its constructor. And for the life of me, I cannot find a way to let the Factory know what my shooter is. Could anyone guide me in the right direction? Link to source repo: https://github.com/hammy3502/survival-extras-2 Files of note: entity.PancakeProjectile, item.PancakeBow, init.ModEntities Thank you so much for any help that can be provided, and apologies if the code is a mess right now, I'm hoping to clean it up once I have most of the things from my 1.12 ported over.
-
Going to open up another thread about the issue I've run into, since the title no longer fits this one
-
The repo is currently a bit of a mess, as I'm currently porting over from 1.12 before I focus on cleaning up with how different 1.16 is in comparison 1.12.
-
https://github.com/hammy3502/survival-extras-2