Skip to content

Commit 5304816

Browse files
updating the README.md
Signed-off-by: Real Ant Engineer <[email protected]>
1 parent bb791d0 commit 5304816

File tree

8 files changed

+52
-233
lines changed

8 files changed

+52
-233
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
![Creating Space Logo](https://realantengineer.github.io//assets/images/logo/creatingspace_text.png)
2+
3+
----
4+
5+
![GitHub commit activity](https://img.shields.io/github/commit-activity/t/RealAntEngineer/creating_space?style=for-the-badge)
6+
![GitHub last commit](https://img.shields.io/github/last-commit/RealAntEngineer/creating_space?style=for-the-badge)
7+
![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/RealAntEngineer/creating_space?style=for-the-badge)
8+
![GitHub forks](https://img.shields.io/github/forks/RealAntEngineer/creating_space?style=for-the-badge)
9+
![GitHub Repo stars](https://img.shields.io/github/stars/RealAntEngineer/creating_space?style=for-the-badge)
10+
11+
<a href="https://www.curseforge.com/minecraft/mc-mods/create-creating-space"><img src="https://realantengineer.github.io//assets/images/Available_on_Curseforge.png" width=24.25% height=24.25% /></a>
12+
<a href="https://modrinth.com/mod/creating-space"><img src="https://realantengineer.github.io//assets/images/Available_on_Modrinth.png" width=24.25% height=24.25% /></a>
13+
<a href="https://discord.gg/Dn9DhTqarH"><img src="https://realantengineer.github.io//assets/images/Chat_With_Us_on_discord.png" width=24.25% height=24.25% /></a>
14+
<a href="https://creating-space.fandom.com/wiki/Creating_Space_Wiki"><img src="https://realantengineer.github.io//assets/images/Check_the_wiki.png" width=24.25% height=24.25% /></a>
15+
16+
----
17+
18+
### Creating Space is a mod that allow you to create rocket using contraptions and go to other planets. Be prepared to design a rocket inspired by realistic science.
19+
20+
----
21+
22+
## Contributing
23+
24+
We welcome contributions from the community! To contribute:
25+
26+
1. Fork the repository.
27+
2. Create a new branch (`git checkout -b feature/YourFeature`).
28+
3. Commit your changes (`git commit -am 'Add a new feature'`).
29+
4. Push to the branch (`git push origin feature/YourFeature`).
30+
5. Open a Pull Request.
31+
32+
Please read the [CONTRIBUTING](CONTRIBUTING.md) file for more details.

README.txt

Lines changed: 0 additions & 46 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ registrate_version = MC1.20-1.3.3
3030
jei_version=15.19.5.99
3131

3232
curios_version = 5.2.0-beta.3+1.20.1
33-
formicapi_version = 1.0
33+
formicapi_version = 1.1
3434

3535
mod_group_id=com.rae.creatingspace
3636
mod_authors=Real Ant Engineer

src/main/java/com/rae/creatingspace/content/event/CSEventHandler.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -119,29 +119,6 @@ public static void blockChange(BlockEvent.NeighborNotifyEvent event){
119119
);
120120
}
121121
//TODO put in the formic API
122-
private static float dichotomy(Function<Float, Float> function, float a, float b, float epsilon) {
123-
try {
124-
if (function.apply(a) * function.apply(b) > 0) { //On vérifie l 'encadrement de la fonction
125-
throw new RuntimeException("Mauvais choix de a ou b.");
126-
} else {
127-
float m = (float) ((a + b) / 2.);
128-
while (abs(a - b) > epsilon) {
129-
if (function.apply(m) == 0.0) {
130-
return m;
131-
} else if (function.apply(a) * function.apply(m) > 0) {
132-
a = m;
133-
} else {
134-
b = m;
135-
}
136-
m = (a + b) / 2;
137-
}
138-
return m;
139-
}
140-
} catch (RuntimeException e) {
141-
System.out.println(e);
142-
return 0;
143-
}
144-
}
145122

146123

147124
public static boolean checkPlayerO2Equipment(ServerPlayer player){

src/main/java/com/rae/creatingspace/content/rocket/engine/EngineItem.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public EngineItem(Block block, Properties properties) {
2828
}
2929

3030
@Override
31-
protected boolean canPlace(BlockPlaceContext pContext, BlockState pState) {
31+
protected boolean canPlace(BlockPlaceContext pContext, @NotNull BlockState pState) {
3232
RocketEngineBlock main = (RocketEngineBlock) getBlock();
3333
Level lvl = pContext.getLevel();
3434
Direction facing = pContext.getClickedFace();
@@ -56,7 +56,7 @@ protected boolean canPlace(BlockPlaceContext pContext, BlockState pState) {
5656
}
5757

5858
@Override
59-
protected boolean placeBlock(BlockPlaceContext pContext, BlockState pState) {
59+
protected boolean placeBlock(BlockPlaceContext pContext, @NotNull BlockState pState) {
6060
RocketEngineBlock main = (RocketEngineBlock) getBlock();
6161
Level lvl = pContext.getLevel();
6262
Direction facing = pContext.getClickedFace();
@@ -75,7 +75,7 @@ protected boolean placeBlock(BlockPlaceContext pContext, BlockState pState) {
7575
}
7676

7777
@Override
78-
public ItemStack getDefaultInstance() {
78+
public @NotNull ItemStack getDefaultInstance() {
7979

8080
int thrust = 1000;
8181
float efficiency = 1f;
@@ -101,7 +101,7 @@ public ItemStack getItemStackFromInfo(int thrust, float efficiency, int mass, Re
101101
}
102102

103103
@Override
104-
public void appendHoverText(ItemStack itemStack, @Nullable Level level, List<Component> components, TooltipFlag flag) {
104+
public void appendHoverText(ItemStack itemStack, @Nullable Level level, @NotNull List<Component> components, @NotNull TooltipFlag flag) {
105105
CompoundTag beTag = itemStack.getOrCreateTagElement("blockEntity");
106106
appendEngineDependentText(components, beTag);
107107
super.appendHoverText(itemStack, level, components, flag);

src/main/java/com/rae/creatingspace/content/rocket/engine/RocketEngineBlock.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.rae.formicapi.multiblock.MBController;
44
import com.rae.formicapi.multiblock.MBShape;
55
import com.rae.creatingspace.init.ingameobject.BlockEntityInit;
6+
import com.rae.formicapi.multiblock.MBStructureBlock;
67
import com.simibubi.create.foundation.block.IBE;
78
import com.simibubi.create.foundation.utility.CreateLang;
89
import net.minecraft.core.BlockPos;
@@ -39,8 +40,8 @@ public RocketEngineBlock(Properties properties, DirectionalBlock structure) {
3940
}
4041

4142
@Override
42-
protected MBShape makeShapes(DirectionalBlock structure) {
43-
return MBShape.make2x1x1(structure);
43+
protected MBShape makeShapes(DirectionalBlock structure) {//this is a bug in the API
44+
return MBShape.make2x1x1((MBStructureBlock) structure);
4445
}
4546

4647
@Override
Lines changed: 11 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.rae.creatingspace.content.rocket.engine;
22

33
import com.rae.creatingspace.init.ingameobject.BlockInit;
4+
import com.rae.formicapi.multiblock.MBStructureBlock;
45
import com.simibubi.create.api.equipment.goggles.IProxyHoveringInformation;
56
import com.simibubi.create.content.equipment.wrench.IWrenchable;
67
import com.simibubi.create.foundation.block.render.MultiPosDestructionHandler;
@@ -29,86 +30,34 @@
2930
import net.minecraftforge.api.distmarker.Dist;
3031
import net.minecraftforge.api.distmarker.OnlyIn;
3132
import net.minecraftforge.client.extensions.common.IClientBlockExtensions;
33+
import org.jetbrains.annotations.NotNull;
3234
import org.jetbrains.annotations.Nullable;
35+
import org.lwjgl.system.NonnullDefault;
3336

3437
import java.util.ArrayList;
3538
import java.util.HashSet;
3639
import java.util.Set;
3740
import java.util.function.Consumer;
38-
39-
public class SuperRocketStructuralBlock extends DirectionalBlock implements IWrenchable, IProxyHoveringInformation {
40-
41+
import java.util.function.Supplier;
42+
@NonnullDefault
43+
public class SuperRocketStructuralBlock extends MBStructureBlock implements IProxyHoveringInformation {
4144
public SuperRocketStructuralBlock(Properties p_52591_) {
4245
super(p_52591_);
4346
}
44-
45-
@Override
46-
protected void createBlockStateDefinition(Builder<Block, BlockState> pBuilder) {
47-
super.createBlockStateDefinition(pBuilder.add(FACING));
48-
}
49-
50-
@Override
51-
public float getShadeBrightness(BlockState pState, BlockGetter pLevel, BlockPos pPos) {
52-
return 1.0F;
53-
}
54-
55-
@Override
56-
public boolean propagatesSkylightDown(BlockState pState, BlockGetter pReader, BlockPos pPos) {
57-
return true;
58-
}
59-
60-
@Override
61-
public InteractionResult onWrenched(BlockState state, UseOnContext context) {
62-
return InteractionResult.PASS;
63-
}
64-
6547
@Override
6648
public ItemStack getCloneItemStack(BlockGetter pLevel, BlockPos pPos, BlockState pState) {
67-
return BlockInit.SMALL_ROCKET_ENGINE.asStack();
68-
}
69-
70-
@Override
71-
public InteractionResult onSneakWrenched(BlockState state, UseOnContext context) {
72-
BlockPos clickedPos = context.getClickedPos();
73-
Level level = context.getLevel();
74-
75-
if (stillValid(level, clickedPos, state)) {
76-
BlockPos masterPos = getMaster(level, clickedPos, state);
77-
context = new UseOnContext(level, context.getPlayer(), context.getHand(), context.getItemInHand(),
78-
new BlockHitResult(context.getClickLocation(), context.getClickedFace(), masterPos,
79-
context.isInside()));
80-
state = level.getBlockState(masterPos);
81-
}
82-
83-
return IWrenchable.super.onSneakWrenched(state, context);
84-
}
85-
86-
87-
/*@Override
88-
public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) {
89-
if (stillValid(pLevel, pPos, pState)) {
90-
pLevel.destroyBlock(getMaster(pLevel, pPos, pState), true);
91-
}
92-
}*/
93-
94-
public void playerWillDestroy(Level pLevel, BlockPos pPos, BlockState pState, Player pPlayer) {
95-
if (stillValid(pLevel, pPos, pState)) {
96-
BlockPos masterPos = getMaster(pLevel, pPos, pState);
97-
pLevel.destroyBlockProgress(masterPos.hashCode(), masterPos, -1);
98-
if (!pLevel.isClientSide() && pPlayer.isCreative())
99-
pLevel.destroyBlock(masterPos, false);
100-
}
101-
super.playerWillDestroy(pLevel, pPos, pState, pPlayer);
49+
return stillValid(pLevel,pPos,pState)?pLevel.getBlockState(getMaster(pLevel,pPos,pState)).getBlock().getCloneItemStack(pLevel, pPos, pState):ItemStack.EMPTY;
10250
}
10351

10452
@Override
10553
public BlockState updateShape(BlockState pState, Direction pFacing, BlockState pFacingState, LevelAccessor pLevel,
106-
BlockPos pCurrentPos, BlockPos pFacingPos) {
54+
BlockPos pCurrentPos, BlockPos pFacingPos) {
10755
if (stillValid(pLevel, pCurrentPos, pState)) {
10856
BlockPos masterPos = getMaster(pLevel, pCurrentPos, pState);
57+
Block masterBlock = pLevel.getBlockState(masterPos).getBlock();
10958
if (!pLevel.getBlockTicks()
110-
.hasScheduledTick(masterPos, BlockInit.SMALL_ROCKET_ENGINE.get()))
111-
pLevel.scheduleTick(masterPos, BlockInit.SMALL_ROCKET_ENGINE.get(), 1);
59+
.hasScheduledTick(masterPos, masterBlock))
60+
pLevel.scheduleTick(masterPos, masterBlock, 1);
11261
return pState;
11362
}
11463
if (!(pLevel instanceof Level level) || level.isClientSide())
@@ -118,98 +67,4 @@ public BlockState updateShape(BlockState pState, Direction pFacing, BlockState p
11867
level.scheduleTick(pCurrentPos, this, 1);
11968
return pState;
12069
}
121-
122-
public static BlockPos getMaster(BlockGetter level, BlockPos pos, BlockState state) {
123-
//makeSomething to prevent stackOverFlow -> while
124-
ArrayList<BlockPos> posDiscovered = new ArrayList<>();
125-
//posDiscovered.add(pos);
126-
BlockState targetedState;
127-
BlockPos targetedPos = pos;
128-
//make it like the oxygen ... and make something to prevent a lo
129-
while (!posDiscovered.contains(pos) && posDiscovered.size() < 10) {
130-
targetedState = level.getBlockState(targetedPos);
131-
132-
if (targetedState.is(BlockInit.ENGINE_STRUCTURAL.get())) {
133-
posDiscovered.add(targetedPos);
134-
} else if (targetedState.is(BlockInit.ROCKET_ENGINE.get())) {
135-
return targetedPos;
136-
}
137-
if (targetedState.hasProperty(FACING)) {
138-
Direction direction = level.getBlockState(targetedPos).getValue(FACING);
139-
140-
targetedPos = pos.relative(direction);
141-
} else {
142-
return targetedPos;
143-
}
144-
145-
}
146-
147-
return targetedPos;
148-
}
149-
150-
public boolean stillValid(BlockGetter level, BlockPos pos, BlockState state) {
151-
if (!state.is(this))
152-
return false;
153-
154-
Direction direction = state.getValue(FACING);
155-
BlockPos targetedPos = pos.relative(direction);
156-
BlockState targetedState = level.getBlockState(targetedPos);
157-
return targetedState.getBlock() instanceof SuperRocketStructuralBlock ||
158-
targetedState.getBlock() instanceof RocketEngineBlock;
159-
}
160-
161-
@Override
162-
public void tick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) {
163-
if (!stillValid(pLevel, pPos, pState)) {
164-
pLevel.setBlockAndUpdate(pPos, Blocks.AIR.defaultBlockState());
165-
}
166-
}
167-
168-
@OnlyIn(Dist.CLIENT)
169-
public void initializeClient(Consumer<IClientBlockExtensions> consumer) {
170-
consumer.accept(new RenderProperties());
171-
}
172-
173-
@Override
174-
public boolean addLandingEffects(BlockState state1, ServerLevel level, BlockPos pos, BlockState state2,
175-
LivingEntity entity, int numberOfParticles) {
176-
return true;
177-
}
178-
179-
public static class RenderProperties implements IClientBlockExtensions, MultiPosDestructionHandler {
180-
181-
@Override
182-
public boolean addDestroyEffects(BlockState state, Level Level, BlockPos pos, ParticleEngine manager) {
183-
return true;
184-
}
185-
186-
@Override
187-
public boolean addHitEffects(BlockState state, Level level, HitResult target, ParticleEngine manager) {
188-
if (target instanceof BlockHitResult bhr) {
189-
BlockPos targetPos = bhr.getBlockPos();
190-
@NonnullType SuperRocketStructuralBlock structuralBlock = BlockInit.ENGINE_STRUCTURAL.get();
191-
if (structuralBlock.stillValid(level, targetPos, state))
192-
manager.crack(SuperRocketStructuralBlock.getMaster(level, targetPos, state), bhr.getDirection());
193-
return true;
194-
}
195-
return IClientBlockExtensions.super.addHitEffects(state, level, target, manager);
196-
}
197-
198-
@Override
199-
@Nullable
200-
public Set<BlockPos> getExtraPositions(ClientLevel level, BlockPos pos, BlockState blockState, int progress) {
201-
@NonnullType SuperRocketStructuralBlock structuralBlock = BlockInit.ENGINE_STRUCTURAL.get();
202-
if (!structuralBlock.stillValid(level, pos, blockState))
203-
return null;
204-
HashSet<BlockPos> set = new HashSet<>();
205-
set.add(SuperRocketStructuralBlock.getMaster(level, pos, blockState));
206-
return set;
207-
}
208-
}
209-
210-
@Override
211-
public BlockPos getInformationSource(Level level, BlockPos pos, BlockState state) {
212-
return stillValid(level, pos, state) ? getMaster(level, pos, state) : pos;
213-
}
214-
21570
}

src/main/java/com/rae/creatingspace/init/ingameobject/BlockInit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class BlockInit {
9191
.transform(customItemModel())
9292
.register();
9393
public static final BlockEntry<SuperRocketStructuralBlock> ENGINE_STRUCTURAL =
94-
REGISTRATE.block("engine_structure", SuperRocketStructuralBlock::new)
94+
REGISTRATE.block("engine_structure",SuperRocketStructuralBlock::new)
9595
//.initialProperties(SharedProperties::copperMetal)
9696
.properties(p -> p.strength(1.0f))
9797
.blockstate((c, p) -> p.getVariantBuilder(c.get())

0 commit comments

Comments
 (0)