Skip to content

Commit

Permalink
Fix translation for bullets
Browse files Browse the repository at this point in the history
  • Loading branch information
malte0811 committed Sep 29, 2024
1 parent 24c08ed commit 8d5d0dd
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private void verify()
final var failed = new MutableBoolean();
for(var item : IEItems.REGISTER.getEntries())
if(!item.getKey().location().getPath().startsWith("fake_icon"))
assertMapped(mapData, failed, item.get().getDescriptionId());
assertMapped(mapData, failed, item.get().getDescriptionId(item.get().getDefaultInstance()));
for(var shader : ShaderRegistry.shaderRegistry.keySet())
assertMapped(mapData, failed, ShaderItem.getShaderNameKey(shader));
if(failed.booleanValue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import blusunrize.immersiveengineering.api.energy.ThermoelectricSource;
import blusunrize.immersiveengineering.api.energy.WindmillBiome;
import blusunrize.immersiveengineering.api.tool.BulletHandler;
import blusunrize.immersiveengineering.api.utils.Color4;
import blusunrize.immersiveengineering.api.wires.WireType;
import blusunrize.immersiveengineering.common.blocks.metal.WarningSignBlock.WarningSignIcon;
import blusunrize.immersiveengineering.common.crafting.GeneratedListRecipe;
Expand Down Expand Up @@ -217,8 +218,8 @@ private void recipesBlueprint(RecipeOutput out)
.build(out, toRL("blueprint/bullet_potion"));

ItemStack flare = new ItemStack(BulletHandler.getBulletItem(IEBullets.FLARE), 4);
DataComponentType<Integer> flareComponent = (DataComponentType<Integer>)IEDataComponents.getBulletData(BulletHandler.getBullet(IEBullets.FLARE));
flare.set(flareComponent, 0xcc2e06);
DataComponentType<Color4> flareComponent = IEDataComponents.getBulletData(IEBullets.FLARE_TYPE);
flare.set(flareComponent, Color4.fromRGB(0xcc2e06));
BlueprintCraftingRecipeBuilder.builder()
.category("specialBullet")
.output(flare.copy())
Expand All @@ -227,7 +228,7 @@ private void recipesBlueprint(RecipeOutput out)
.input(IETags.getTagsFor(EnumMetals.ALUMINUM).dust)
.input(Tags.Items.DYES_RED)
.build(out, toRL("blueprint/bullet_flare_red"));
flare.set(flareComponent, 0x2ca30b);
flare.set(flareComponent, Color4.fromRGB(0x2ca30b));
BlueprintCraftingRecipeBuilder.builder()
.category("specialBullet")
.output(flare.copy())
Expand All @@ -236,7 +237,7 @@ private void recipesBlueprint(RecipeOutput out)
.input(IETags.getTagsFor(EnumMetals.ALUMINUM).dust)
.input(Tags.Items.DYES_GREEN)
.build(out, toRL("blueprint/bullet_flare_green"));
flare.set(flareComponent, 0xffff82);
flare.set(flareComponent, Color4.fromRGB(0xffff82));
BlueprintCraftingRecipeBuilder.builder()
.category("specialBullet")
.output(flare.copy())
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public BlockItemIE(Block b)
}

@Override
public String getDescriptionId(ItemStack stack)
public String getDescriptionId()
{
return getBlock().getDescriptionId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import blusunrize.immersiveengineering.common.items.IEItemInterfaces.IColouredItem;
import blusunrize.immersiveengineering.common.register.IEDataComponents;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
Expand All @@ -22,7 +21,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

Expand All @@ -44,18 +42,6 @@ public void appendHoverText(ItemStack stack, TooltipContext ctx, List<Component>
type.addTooltip(stack.get(component), ctx, list, flag);
}

@Nonnull
@Override
public Component getName(@Nonnull ItemStack stack)
{
// TODO fix
String s = "item.immersiveengineering.bullet.";
String key = BuiltInRegistries.ITEM.getKey(this).getPath();
s += key;
s = type.getTranslationKey(stack.get(component), s);
return Component.translatable(s);
}

@Override
public int getColourForIEItem(ItemStack stack, int pass)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ public EngineersBlueprintItem()
super(new Properties().stacksTo(1));
}

@Nonnull
@Override
public String getDescriptionId(ItemStack stack)
{
return this.getDescriptionId();
}

@Override
public void appendHoverText(ItemStack stack, TooltipContext ctx, List<Component> list, TooltipFlag flag)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;

import javax.annotation.Nonnull;
import java.util.List;

public class LogicCircuitBoardItem extends IEBaseItem
Expand All @@ -27,13 +26,6 @@ public LogicCircuitBoardItem()
super(new Properties().stacksTo(1));
}

@Nonnull
@Override
public String getDescriptionId(ItemStack stack)
{
return this.getDescriptionId();
}

@Override
public void appendHoverText(ItemStack stack, TooltipContext ctx, List<Component> list, TooltipFlag flag)
{
Expand Down

0 comments on commit 8d5d0dd

Please sign in to comment.