fixed a bunch of typos and added sounds :D

This commit is contained in:
TheBlackfurGuy 2022-01-05 20:00:29 +01:00
parent 33a1396208
commit 63db9920b2
8 changed files with 75 additions and 13 deletions

View file

@ -4,8 +4,15 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="Finally fixed a dumb sync issue :D">
<list default="true" id="9d600e86-9aa6-49ee-bbc5-e23128c6a4d1" name="Changes" comment="one texture file was missing">
<change afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/sounds.json" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/sounds/toaster_lock.ogg" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/sounds/toaster_release.ogg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/Tastytoasters.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/Tastytoasters.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlock.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/blackfur/tastytoasters/block/ToasterBlockEntity.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/lang/en_us.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/assets/tastytoasters/lang/en_us.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -98,7 +105,7 @@
<recent name="$PROJECT_DIR$/Temp" />
</key>
</component>
<component name="RunManager" selected="Gradle.tastytoasters [runClient]">
<component name="RunManager" selected="Gradle.tastytoasters [build]">
<configuration name="tastytoasters [buildDependents]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
@ -195,8 +202,8 @@
</list>
<recent_temporary>
<list>
<item itemvalue="Gradle.tastytoasters [buildDependents]" />
<item itemvalue="Gradle.tastytoasters [build]" />
<item itemvalue="Gradle.tastytoasters [buildDependents]" />
<item itemvalue="Gradle.tastytoasters [runClient]" />
</list>
</recent_temporary>
@ -280,7 +287,14 @@
<option name="project" value="LOCAL" />
<updated>1641323089333</updated>
</task>
<option name="localTasksCounter" value="11" />
<task id="LOCAL-00011" summary="one texture file was missing">
<created>1641398298085</created>
<option name="number" value="00011" />
<option name="presentableId" value="LOCAL-00011" />
<option name="project" value="LOCAL" />
<updated>1641398298085</updated>
</task>
<option name="localTasksCounter" value="12" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -306,6 +320,7 @@
<MESSAGE value="Its pretty much finished?" />
<MESSAGE value="welll it seems there is a fabric api bug" />
<MESSAGE value="Finally fixed a dumb sync issue :D" />
<option name="LAST_COMMIT_MESSAGE" value="Finally fixed a dumb sync issue :D" />
<MESSAGE value="one texture file was missing" />
<option name="LAST_COMMIT_MESSAGE" value="one texture file was missing" />
</component>
</project>

View file

@ -11,6 +11,7 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
@ -26,6 +27,11 @@ public class Tastytoasters implements ModInitializer {
public static BlockEntityType<ToasterBlockEntity> TOASTER_BLOCK_ENTITY;
public static final Identifier TOASTER_LOCK_SOUND_ID = new Identifier("tastytoasters:toaster_lock");
public static final Identifier TOASTER_RELEASE_SOUND_ID = new Identifier("tastytoasters:toaster_release");
public static SoundEvent TOASTER_LOCK_SOUND_EVENT = new SoundEvent(TOASTER_LOCK_SOUND_ID);
public static SoundEvent TOASTER_RELEASE_SOUND_EVENT = new SoundEvent(TOASTER_RELEASE_SOUND_ID);
@Override
public void onInitialize() {
Registry.register(Registry.ITEM, new Identifier("tastytoasters", "raw_toast"), RAW_TOAST_ITEM);
@ -38,5 +44,8 @@ public class Tastytoasters implements ModInitializer {
Registry.register(Registry.ITEM, new Identifier("tastytoasters", "toaster"), new BlockItem(TOASTER_BLOCK, new Item.Settings().group(ItemGroup.FOOD)));
TOASTER_BLOCK_ENTITY = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier("tastytoasters", "toaster_entity"), FabricBlockEntityTypeBuilder.create(ToasterBlockEntity::new, TOASTER_BLOCK).build(null));
Registry.register(Registry.SOUND_EVENT, TOASTER_LOCK_SOUND_ID, TOASTER_LOCK_SOUND_EVENT);
Registry.register(Registry.SOUND_EVENT, TOASTER_RELEASE_SOUND_ID, TOASTER_RELEASE_SOUND_EVENT);
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
@ -40,6 +41,16 @@ public class ToasterBlock extends BlockWithEntity implements BlockEntityProvider
player.getStackInHand(hand).setCount(player.getStackInHand(hand).getCount()-1);
world.setBlockState(pos, state.with(TOASTING, true));
toasterBlockEntity.handleUse();
if (!world.isClient) {
world.playSound(
null,
pos,
Tastytoasters.TOASTER_LOCK_SOUND_EVENT,
SoundCategory.BLOCKS,
1.0F,
1.0F
);
}
}
return ActionResult.success(world.isClient());
}

View file

@ -6,6 +6,7 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -19,16 +20,26 @@ public class ToasterBlockEntity extends BlockEntity {
public static void tick(World world, BlockPos pos, BlockState state, ToasterBlockEntity be) {
if (state.get(ToasterBlock.TOASTING)) {
if (be.cookTicks % 100 == 0) {
if (be.cookTicks % 50 == 0) {
world.addParticle(ParticleTypes.SMOKE, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0, 0, 0);
}
if (be.cookTicks <= 0) {
world.setBlockState(pos, state.with(ToasterBlock.TOASTING, false));
if ((int) (Math.random() * 10) == 0) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.BURNT_TOAST_ITEM.getDefaultStack()));
} else {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.TOAST_ITEM.getDefaultStack()));
}
if (!world.isClient) {
world.playSound(
null,
pos,
Tastytoasters.TOASTER_RELEASE_SOUND_EVENT,
SoundCategory.BLOCKS,
1.0F,
1.0F
);
}
if ((int) (Math.random() * 10) == 0) {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.BURNT_TOAST_ITEM.getDefaultStack()));
} else {
world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY() + 0.5, pos.getZ(), Tastytoasters.TOAST_ITEM.getDefaultStack()));
}
}
be.cookTicks--;

View file

@ -5,11 +5,13 @@
"item.tastytoasters.toast.tooltip": "Tasty but you can do better",
"item.tastytoasters.burnt_toast": "Burnt Toast",
"item.tastytoasters.burnt_toast.tooltip": "What have you done??",
"item.tastytoasters.butter": "Butter,",
"item.tastytoasters.butter": "Butter",
"item.tastytoasters.butter.tooltip.1": "A yummy ingredient that",
"item.tastytoasters.butter.tooltip.2": "inherits milk properties",
"item.tastytoasters.buttered_toast": "Buttered Toast",
"item.tastytoasters.buttered_toast.tooltip": "So great, but not shiny enough",
"block.tastytoasters.toaster": "Toaster",
"block.tastytoasters.toaster.tooltip": "The gate to happiness"
"block.tastytoasters.toaster.tooltip": "The gate to happiness",
"subtitles.tastytoasters.toaster_lock": "Toaster locks",
"subtitles.tastytoasters.toaster_release": "Toaster releases"
}

View file

@ -0,0 +1,14 @@
{
"toaster_lock": {
"subtitle": "subtitles.tastytoasters.toaster_lock",
"sounds": [
"tastytoasters:toaster_lock"
]
},
"toaster_release": {
"subtitle": "subtitles.tastytoasters.toaster_release",
"sounds": [
"tastytoasters:toaster_release"
]
}
}